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

Code before:
            'view_count': int,
        },
    }]

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

        formats = []
        for definition in traverse_obj(moment, (
            'videoInfo', 'definitions', lambda _, v: url_or_none(v['m3u8']),
        )):
            fmts = self._extract_m3u8_formats(definition['m3u8'], video_id, 'mp4', fatal=False)
            for fmt in fmts:
                fmt.update(**traverse_obj(definition, {
                    'filesize': ('size', {int_or_none}),
                    'format_id': ('defName', {str}),
                    'height': ('height', {int_or_none}),
                    'quality': ('definition', {int_or_none}),
                    'width': ('width', {int_or_none}),
                }))
            formats.extend(fmts)
        if not formats:
            self.raise_no_formats('No video found')

        return {
            'id': video_id,
            'formats': formats,
            **traverse_obj(moment, {
                'comment_count': ('commentCount', {int_or_none}),
                'description': ('content', {clean_html}, filter),
                'like_count': ('favorCount', {int_or_none}),
                'timestamp': ('cTime', {int_or_none}),
            }),
            **traverse_obj(moment, ('videoInfo', {
                'title': ('videoTitle', {str}),
                'categories': ('category', {str}, filter, all, filter),
                'duration': ('videoDuration', {parse_duration}),
                'tags': ('tags', ..., {str}, filter, all, filter),
                'thumbnail': (('videoBigCover', 'videoCover'), {url_or_none}, {update_url(query=None)}, any),
                'uploader': ('nickName', {str}),
                'uploader_id': ('uid', {str_or_none}),
                'view_count': ('videoPlayNum', {int_or_none}),
            })),
        }


Review comment (suggestion):
no point to this if it's not expected; core code will `raise_no_formats` if we return an empty formats list
```suggestion
```

Code after:
        },
    }]

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

        formats = []
        for definition in traverse_obj(moment, (
            'videoInfo', 'definitions', lambda _, v: url_or_none(v['m3u8']),
        )):
            fmts = self._extract_m3u8_formats(definition['m3u8'], video_id, 'mp4', fatal=False)
            for fmt in fmts:
                fmt.update(**traverse_obj(definition, {
                    'filesize': ('size', {int_or_none}),
                    'format_id': ('defName', {str}),
                    'height': ('height', {int_or_none}),
                    'quality': ('definition', {int_or_none}),
                    'width': ('width', {int_or_none}),
                }))
            formats.extend(fmts)

        return {
            'id': video_id,
            'formats': formats,
            **traverse_obj(moment, {
                'comment_count': ('commentCount', {int_or_none}),
                'description': ('content', {clean_html}, filter),
                'like_count': ('favorCount', {int_or_none}),
                'timestamp': ('cTime', {int_or_none}),
            }),
            **traverse_obj(moment, ('videoInfo', {
                'title': ('videoTitle', {str}),
                'categories': ('category', {str}, filter, all, filter),
                'duration': ('videoDuration', {parse_duration}),
                'tags': ('tags', ..., {str}, filter, all, filter),
                'thumbnail': (('videoBigCover', 'videoCover'), {url_or_none}, {update_url(query=None)}, any),
                'uploader': ('nickName', {str}),
                'uploader_id': ('uid', {str_or_none}),
                'view_count': ('videoPlayNum', {int_or_none}),
            })),
        }