Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/huya.py (Python)

Code before:
        })
        fm = base64.b64decode(params['fm']).decode().split('_', 1)[0]
        ss = hashlib.md5('|'.join([params['seqid'], params['ctype'], params['t']]))
        return fm, ss


class HuyaVideoIE(InfoExtractor):
    _VALID_URL = r'https://(?:www\.)?huya\.com/video/play/(?P<id>\d+)\.html'

    IE_NAME = 'huya:video'
    IE_DESC = '虎牙视频'

    _TESTS = [{
        'url': 'https://www.huya.com/video/play/1002412640.html',
        'info_dict': {
            'id': '1002412640',
            'title': '8月3日',
            'thumbnail': r're:https://.*\.jpg*',
            'format_id': '1080P',
            'url': r're:https?://.*\.mp4*',
            'ext': 'mp4',
            'width': 1728,
            'height': 1080,
            'filesize': 5854080,
            'protocol': 'http',
            'format_note': '1080P - 1728x1080',
            'duration': 14,
            'uploader': '虎牙-ATS欧卡车队青木',
            'uploader_id': '1564376151',
            'upload_date': '20240803',
            'view_count': int,
            'comment_count': int,
            'like_count': int,
        }, 'params': {
            'skip_download': True,
        },
    },
        {
        'url': 'https://www.huya.com/video/play/556054543.html',
        'info_dict': {
            'id': '556054543',
            'title': '我不挑事 也不怕事',
            'thumbnail': r're:https://.*\.jpg*',
            'format_id': '1080P',
            'url': r're:https?://.*\.mp4*',
            'ext': 'mp4',
            'width': 1920,
            'height': 1080,
            'filesize': 368724330,
            'protocol': 'http',
            'format_note': '1080P - 1920x1080',

Review comment (suggestion):
Tests generally don't check the specific formats that are available
```suggestion
```

Code after:
        })
        fm = base64.b64decode(params['fm']).decode().split('_', 1)[0]
        ss = hashlib.md5('|'.join([params['seqid'], params['ctype'], params['t']]))
        return fm, ss


class HuyaVideoIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?huya\.com/video/play/(?P<id>\d+)\.html'
    IE_NAME = 'huya:video'
    IE_DESC = '虎牙视频'

    _TESTS = [{
        'url': 'https://www.huya.com/video/play/1002412640.html',
        'info_dict': {
            'id': '1002412640',
            'ext': 'mp4',
            'title': '8月3日',
            'thumbnail': r're:https?://.*\.jpg',
            'duration': 14,
            'uploader': '虎牙-ATS欧卡车队青木',
            'uploader_id': '1564376151',
            'upload_date': '20240803',
            'view_count': int,
            'comment_count': int,
            'like_count': int,
        },
    },
        {
        'url': 'https://www.huya.com/video/play/556054543.html',
        'info_dict': {
            'id': '556054543',
            'ext': 'mp4',
            'title': '我不挑事 也不怕事',
            'thumbnail': r're:https?://.*\.jpg',
            'duration': 1864,
            'uploader': '卡尔',
            'uploader_id': '367138632',
            'upload_date': '20210811',
            'view_count': int,
            'comment_count': int,
            'like_count': int,
        },
    }]

    def _real_extract(self, url: str):
        video_id = self._match_id(url)
        video_data = self._download_json(
            'https://liveapi.huya.com/moment/getMomentContent', video_id,
            query={'videoId': video_id})['data']['moment']['videoInfo']

        formats = []