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

Code before:
                if uid:
                    params['uid'] = uid

                sid = self._search_regex(r'window\.MDSTRMSID\s*=\s*["\']([^"\']+)["\'];', webpage, 'sid', fatal=False, default=None)
                if sid:
                    params['sid'] = sid

                pid = self._search_regex(r'window\.MDSTRMPID\s*=\s*["\']([^"\']+)["\'];', webpage, 'pid', fatal=False, default=None)
                if pid:
                    params['pid'] = pid

                version = self._search_regex(r'window\.VERSION\s*=\s*["\']([^"\']+)["\'];', webpage, 'version', fatal=False, default=None)
                if version:
                    params['at'] = 'web-app'
                    params['av'] = version

                parsed = urlparse(url)
                if len(parsed.query) > 0:
                    qs = parse_qs(parsed.query)
                    if 'access_token' in qs and len(qs['access_token']) > 0:
                        params['access_token'] = qs['access_token'][0]

                if len(params):
                    src = f'{src}?{urlencode(params)}'

                fmts, subs = self._extract_m3u8_formats_and_subtitles(src, video_id)
                formats.extend(fmts)
                self._merge_subtitles(subs, target=subtitles)
            elif video_format == 'mpd':
                fmts, subs = self._extract_mpd_formats_and_subtitles(player_config['src'][video_format], video_id)
                formats.extend(fmts)
                self._merge_subtitles(subs, target=subtitles)
            else:
                formats.append({
                    'url': player_config['src'][video_format],
                })

        return {
            'id': video_id,
            'title': self._og_search_title(webpage) or player_config.get('title'),
            'description': self._og_search_description(webpage),
            'formats': formats,
            'subtitles': subtitles,
            'is_live': player_config.get('type') == 'live',
            'thumbnail': self._og_search_thumbnail(webpage),
        }


class WinSportsVideoIE(MediaStreamBaseIE):
    _VALID_URL = r'https?://www\.winsports\.co/videos/(?P<id>[\w-]+)'


Review comment (refactor):
```suggestion
                fmts, subs = self._extract_m3u8_formats_and_subtitles(update_url_query(src, params), video_id)
```
Import `update_url_query` from `..utils`

Code after:
                }
                for name, key in (('MDSTRMUID', 'uid'), ('MDSTRMSID', 'sid'), ('MDSTRMPID', 'pid'), ('VERSION', 'av')):
                    params[key] = self._search_regex(
                        rf'window\.{name}\s*=\s*["\']([^"\']+)["\'];', webpage, key, default=None)

                fmts, subs = self._extract_m3u8_formats_and_subtitles(
                    update_url_query(player_config['src'][video_format], filter_dict(params)), video_id)
                formats.extend(fmts)
                self._merge_subtitles(subs, target=subtitles)
            elif video_format == 'mpd':
                fmts, subs = self._extract_mpd_formats_and_subtitles(player_config['src'][video_format], video_id)
                formats.extend(fmts)
                self._merge_subtitles(subs, target=subtitles)
            else:
                formats.append({
                    'url': player_config['src'][video_format],
                })

        return {
            'id': video_id,
            'title': self._og_search_title(webpage) or player_config.get('title'),
            'description': self._og_search_description(webpage),
            'formats': formats,
            'subtitles': subtitles,
            'is_live': player_config.get('type') == 'live',
            'thumbnail': self._og_search_thumbnail(webpage),
        }


class WinSportsVideoIE(MediaStreamBaseIE):
    _VALID_URL = r'https?://www\.winsports\.co/videos/(?P<id>[\w-]+)'

    _TESTS = [{
        'url': 'https://www.winsports.co/videos/siempre-castellanos-gran-atajada-del-portero-cardenal-para-evitar-la-caida-de-su-arco-60536',
        'info_dict': {
            'id': '62dc8357162c4b0821fcfb3c',
            'display_id': 'siempre-castellanos-gran-atajada-del-portero-cardenal-para-evitar-la-caida-de-su-arco-60536',
            'title': '¡Siempre Castellanos! Gran atajada del portero \'cardenal\' para evitar la caída de su arco',
            'description': 'md5:eb811b2b2882bdc59431732c06b905f2',
            'thumbnail': r're:^https?://[^?#]+62dc8357162c4b0821fcfb3c',
            'ext': 'mp4',
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'https://www.winsports.co/videos/observa-aqui-los-goles-del-empate-entre-tolima-y-nacional-60548',
        'info_dict': {
            'id': '62dcb875ef12a5526790b552',
            'display_id': 'observa-aqui-los-goles-del-empate-entre-tolima-y-nacional-60548',
            'title': 'Observa aquí los goles del empate entre Tolima y Nacional',
            'description': 'md5:b19402ba6e46558b93fd24b873eea9c9',
            'thumbnail': r're:^https?://[^?#]+62dcb875ef12a5526790b552',