diff --git a/yt_dlp/extractor/huya.py b/yt_dlp/extractor/huya.py index e8190a372..65099b062 100644 --- a/yt_dlp/extractor/huya.py +++ b/yt_dlp/extractor/huya.py @@ -21,10 +21,9 @@ class HuyaLiveIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.|m\.)?huya\.com/(?!(?:video/play/))(?P[^/#?&]+)(?:\D|$)' IE_NAME = 'huya:live' IE_DESC = '虎牙直播' - - _VALID_URL = r'https?://(?:(?:m|www)\.)?huya\.com/(?!(?:video/play/))(?P[^/#?&]+)(?:\D|$)' _TESTS = [{ 'url': 'https://www.huya.com/572329', 'info_dict': { @@ -141,10 +140,10 @@ def encrypt(self, params, stream_info, stream_name): class HuyaVideoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?huya\.com/video/play/(?P\d+)\.html' IE_NAME = 'huya:video' IE_DESC = '虎牙视频' - _VALID_URL = r'https?://(?:www\.)?huya\.com/video/play/(?P\d+)\.html' _TESTS = [{ 'url': 'https://www.huya.com/video/play/1002412640.html', 'info_dict': { @@ -221,8 +220,6 @@ def _real_extract(self, url: str): 'width': ('width', {int_or_none}), })) formats.extend(fmts) - if not formats: - self.raise_no_formats('No video found') return { 'id': video_id,