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

Code before:
                    video_id, 'mp4', fatal=False)

                formats.extend(fmts)
                self._merge_subtitles(subs, target=subtitles)
            else:
                formats.append({
                    'url': f'{video_format["url"]}{video_response["fn"]}?vkey={video_response["fvkey"]}',
                    'ext': 'mp4',
                })

        identifier = video_response.get('br')
        format_response = traverse_obj(
            api_response, ('fl', 'fi', lambda _, v: v['br'] == identifier),
            expected_type=dict, get_all=False) or {}
        format_id = format_response.get('name')
        is_hdr = format_id == 'hdr10'
        format_name = f'{format_response.get("sname")} ({format_response.get("resolution")})' + (' HDR' if is_hdr else '')
        common_info = {
            'width': video_response.get('vw'),
            'height': video_response.get('vh'),
            'abr': float_or_none(format_response.get('audiobandwidth'), scale=1000),
            'vbr': float_or_none(format_response.get('bandwidth'), scale=1000),
            'fps': format_response.get('vfps'),
            'format': format_name,
            'format_id': format_id,
            'format_note': format_name,
            'dynamic_range': 'hdr10' if is_hdr else None,
            'has_drm': format_response.get('drm', 0) != 0,
        }
        for f in formats:
            f.update(common_info)

        return formats, subtitles

    def _extract_video_native_subtitles(self, api_response):
        subtitles = {}
        for subtitle in traverse_obj(api_response, ('sfl', 'fi')) or ():
            subtitles.setdefault(subtitle['lang'].lower(), []).append({
                'url': subtitle['url'],
                'ext': 'srt' if subtitle.get('captionType') == 1 else 'vtt',
                'protocol': 'm3u8_native' if determine_ext(subtitle['url']) == 'm3u8' else 'http',
            })

        return subtitles

    def _extract_all_video_formats_and_subtitles(self, url, video_id, series_id):
        api_response = self._get_video_api_response(url, video_id, series_id, 'srt', 'hls', 'hd')
        self._check_api_response(api_response)
        api_responses = [api_response]
        qualities = traverse_obj(api_response, ('fl', 'fi', ..., 'name')) or ('shd', 'fhd')
        for q in qualities:

Review comment (suggestion):
```suggestion
        common_info = {
            'width': video_response.get('vw'),
            'height': video_response.get('vh'),
            'abr': float_or_none(format_response.get('audiobandwidth'), scale=1000),
            'vbr': float_or_none(format_response.get('bandwidth'), scale=1000),
            'fps': format_response.get('vfps'),
            'format': format_response.get('sname'),
            'format_id': format_id,
            'format_note': format_response.get('resolution'),
```

Code after:
            if video_format.get('hls') or determine_ext(video_format['url']) == 'm3u8':
                fmts, subs = self._extract_m3u8_formats_and_subtitles(
                    video_format['url'] + traverse_obj(video_format, ('hls', 'pt'), default=''),
                    video_id, 'mp4', fatal=False)

                formats.extend(fmts)
                self._merge_subtitles(subs, target=subtitles)
            else:
                formats.append({
                    'url': f'{video_format["url"]}{video_response["fn"]}?vkey={video_response["fvkey"]}',
                    'ext': 'mp4',
                })

        identifier = video_response.get('br')
        format_response = traverse_obj(
            api_response, ('fl', 'fi', lambda _, v: v['br'] == identifier),
            expected_type=dict, get_all=False) or {}
        common_info = {
            'width': video_response.get('vw'),
            'height': video_response.get('vh'),
            'abr': float_or_none(format_response.get('audiobandwidth'), scale=1000),
            'vbr': float_or_none(format_response.get('bandwidth'), scale=1000),
            'fps': format_response.get('vfps'),
            'format': format_response.get('sname'),
            'format_id': format_response.get('name'),
            'format_note': format_response.get('resolution'),
            'dynamic_range': {'hdr10': 'hdr10'}.get(format_response.get('name'), 'sdr'),
            'has_drm': format_response.get('drm', 0) != 0,
        }
        for f in formats:
            f.update(common_info)

        return formats, subtitles

    def _extract_video_native_subtitles(self, api_response):
        subtitles = {}
        for subtitle in traverse_obj(api_response, ('sfl', 'fi')) or ():
            subtitles.setdefault(subtitle['lang'].lower(), []).append({
                'url': subtitle['url'],
                'ext': 'srt' if subtitle.get('captionType') == 1 else 'vtt',
                'protocol': 'm3u8_native' if determine_ext(subtitle['url']) == 'm3u8' else 'http',
            })

        return subtitles

    def _extract_all_video_formats_and_subtitles(self, url, video_id, series_id):
        api_responses = [self._get_video_api_response(url, video_id, series_id, 'srt', 'hls', 'hd')]
        self._check_api_response(api_responses[0])
        qualities = traverse_obj(api_responses, (0, 'fl', 'fi', ..., 'name')) or ('shd', 'fhd')
        for q in qualities:
            if q not in ('ld', 'sd', 'hd'):