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

Code before:
                    video_format.get('url') + traverse_obj(video_format, ('hls', 'pname')), video_id, 'mp4', fatal=False)

                for f in fmts:
                    f['width'] = video_width
                    f['height'] = video_height

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

        return formats, subtitles

    def _extract_video_subtitles(self, api_response, subtitles_format):
        subtitles = {}
        for subtitle in traverse_obj(api_response, ('sfl', 'fi')):
            subtitles[subtitle['lang'].lower()] = [{
                'url': subtitle['url'],
                'ext': subtitles_format,
                'protocol': 'm3u8_native' if subtitles_format == 'vtt' else 'http'
            }]

        return subtitles

    def _real_extract(self, url):
        video_id, series_id = self._match_valid_url(url).group('id', 'series_id')
        webpage = self._download_webpage(url, video_id)

        formats, subtitles = [], {}
        for video_format, subtitle_format, video_quality in (('mp4', 'srt', ''), ('hls', 'vtt', 'shd'), ('hls', 'vtt', 'fhd')):
            api_response = self._get_video_api_response(url, video_id, series_id, subtitle_format, video_format, video_quality)

            fmts, subs = self._extract_video_formats_and_subtitles(api_response, video_id, video_quality)
            native_subtitles = self._extract_video_subtitles(api_response, subtitle_format)

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

        self._sort_formats(formats)
        webpage_metadata = self._get_webpage_metadata(webpage, video_id)

        return {
            'id': video_id,
            'title': (self._og_search_title(webpage)
                      or traverse_obj(webpage_metadata, ('coverInfo', 'description'))),

Review comment (suggestion):
```suggestion
            subtitles.setdefault(subtitle['lang'].lower(), []).append({
                'url': subtitle['url'],
                'ext': subtitles_format,
                'protocol': 'm3u8_native' if subtitles_format == 'vtt' else 'http'
            })
```

Code after:
                    video_format['url'] + video_format['hls']['pname'], video_id, 'mp4', fatal=False)
                for f in fmts:
                    f['width'] = video_width
                    f['height'] = video_height

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

        return formats, subtitles

    def _extract_video_subtitles(self, api_response, subtitles_format):
        subtitles = {}
        for subtitle in traverse_obj(api_response, ('sfl', 'fi')):
            subtitles.setdefault(subtitle['lang'].lower(), []).append({
                'url': subtitle['url'],
                'ext': subtitles_format,
                'protocol': 'm3u8_native' if determine_ext(subtitle['url']) == 'm3u8' else 'http',
            })

        return subtitles

    def _real_extract(self, url):
        video_id, series_id = self._match_valid_url(url).group('id', 'series_id')
        webpage = self._download_webpage(url, video_id)

        formats, subtitles = [], {}
        for video_format, subtitle_format, video_quality in (('mp4', 'srt', ''), ('hls', 'vtt', 'shd'), ('hls', 'vtt', 'fhd')):
            api_response = self._get_video_api_response(url, video_id, series_id, subtitle_format, video_format, video_quality)

            fmts, subs = self._extract_video_formats_and_subtitles(api_response, video_id, video_quality)
            native_subtitles = self._extract_video_subtitles(api_response, subtitle_format)

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

        self._sort_formats(formats)
        webpage_metadata = self._get_webpage_metadata(webpage, video_id)

        return {
            'id': video_id,
            'title': (self._og_search_title(webpage)
                      or traverse_obj(webpage_metadata, ('coverInfo', 'description'))),
            'description': (self._og_search_description(webpage)
                            or traverse_obj(webpage_metadata, ('coverInfo', 'description'))),