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

Code before:
            '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:
            if q not in ('ld', 'sd', 'hd'):
                api_response = self._get_video_api_response(
                    url, video_id, series_id, 'vtt', 'hls', q)
                self._check_api_response(api_response)
                api_responses.append(api_response)

        formats, subtitles = [], {}
        for api_response in api_responses:
            fmts, subs = self._extract_video_formats_and_subtitles(api_response, video_id)
            native_subtitles = self._extract_video_native_subtitles(api_response)

            formats.extend(fmts)
            self._merge_subtitles(subs, native_subtitles, target=subtitles)

        return formats, subtitles

    def _get_clean_title(self, title):
        return re.sub(
            r'\s*[_\-]\s*(?:Watch online|Watch HD Video Online|WeTV|腾讯视频|(?:高清)?1080P在线观看平台).*?$',
            '', title or '').strip() or None


class VQQBaseIE(TencentBaseIE):
    _VALID_URL_BASE = r'https?://v\.qq\.com'

Review comment (suggestion):
```suggestion
        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')
```

Code after:
            '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'):
                api_responses.append(self._get_video_api_response(
                    url, video_id, series_id, 'vtt', 'hls', q))
                self._check_api_response(api_responses[-1])

        formats, subtitles = [], {}
        for api_response in api_responses:
            fmts, subs = self._extract_video_formats_and_subtitles(api_response, video_id)
            native_subtitles = self._extract_video_native_subtitles(api_response)

            formats.extend(fmts)
            self._merge_subtitles(subs, native_subtitles, target=subtitles)

        return formats, subtitles

    def _get_clean_title(self, title):
        return re.sub(
            r'\s*[_\-]\s*(?:Watch online|Watch HD Video Online|WeTV|腾讯视频|(?:高清)?1080P在线观看平台).*?$',
            '', title or '').strip() or None


class VQQBaseIE(TencentBaseIE):
    _VALID_URL_BASE = r'https?://v\.qq\.com'

    _API_URL = 'https://h5vv6.video.qq.com/getvinfo'