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

Code before:
            'thumbnail': 're:^https://avatars.dzeninfra.ru/',
            'uploader': 'TechInsider',
            'upload_date': '20210123',
            'timestamp': 1611378221,
            'view_count': int,
            'duration': 243,
            'tags': ['опыт', 'эксперимент', 'огонь'],
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'https://zen.yandex.ru/media/id/606fd806cc13cb3c58c05cf5/novyi-samsung-fold-3-moskvich-barahlit-612f93b7f8d48e7e945792a2?from=channel&rid=2286618386.482.1630817595976.42360',
        'only_matching': True,
    }, {
        'url': 'https://dzen.ru/media/id/606fd806cc13cb3c58c05cf5/novyi-samsung-fold-3-moskvich-barahlit-612f93b7f8d48e7e945792a2?from=channel&rid=2286618386.482.1630817595976.42360',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        video_data = self._fetch_ssr_data(url, video_id)['videoMetaResponse']

        formats, subtitles = [], {}
        # Deduplicate stream URLs. The "dzen_dash" query parameter is present in some URLs but can be omitted
        stream_urls = set(traverse_obj(video_data, (
            'video', ('id', ('streams', ...), ('mp4Streams', ..., 'url'), ('oneVideoStreams', ..., 'url')),
            {url_or_none}, {update_url(query_update={'dzen_dash': []})})))
        for s_url in stream_urls:
            ext = determine_ext(s_url)
            content_type = traverse_obj(parse_qs(s_url), ('ct', 0))
            if ext == 'mpd' or content_type == '6':
                fmts, subs = self._extract_mpd_formats_and_subtitles(s_url, video_id, mpd_id='dash', fatal=False)
            elif ext == 'm3u8' or content_type == '8':
                fmts, subs = self._extract_m3u8_formats_and_subtitles(s_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
            elif content_type == '0':
                format_type = traverse_obj(parse_qs(s_url), ('type', 0))
                quality = qualities(('4', '0', '1', '2', '3', '5', '6', '7'))
                formats.append({
                    'url': s_url,
                    'format_id': format_type,
                    'ext': 'mp4',
                    'quality': quality(format_type),
                })
                continue
            else:
                self.report_warning(f'Unsupported stream URL: {s_url}{bug_reports_message()}')
                continue
            formats.extend(fmts)
            self._merge_subtitles(subs, target=subtitles)

        return {
            'id': video_id,

Review comment (suggestion):
```suggestion
            {url_or_none}, {update_url_query(query={'dzen_dash': []})})))
```
would work too

Code after:
            'description': 'md5:053ad3c61b5596d510c9a199dc8ee633',
            'thumbnail': 're:^https://avatars.dzeninfra.ru/',
            'uploader': 'TechInsider',
            'upload_date': '20210123',
            'timestamp': 1611378221,
            'view_count': int,
            'duration': 243,
            'tags': ['опыт', 'эксперимент', 'огонь'],
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'https://zen.yandex.ru/media/id/606fd806cc13cb3c58c05cf5/novyi-samsung-fold-3-moskvich-barahlit-612f93b7f8d48e7e945792a2?from=channel&rid=2286618386.482.1630817595976.42360',
        'only_matching': True,
    }, {
        'url': 'https://dzen.ru/media/id/606fd806cc13cb3c58c05cf5/novyi-samsung-fold-3-moskvich-barahlit-612f93b7f8d48e7e945792a2?from=channel&rid=2286618386.482.1630817595976.42360',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        video_id, ssr_data = self._fetch_ssr_data(url, video_id)
        video_data = ssr_data['videoMetaResponse']

        formats, subtitles = [], {}
        quality = qualities(('4', '0', '1', '2', '3', '5', '6', '7'))
        # Deduplicate stream URLs. The "dzen_dash" query parameter is present in some URLs but can be omitted
        stream_urls = set(traverse_obj(video_data, (
            'video', ('id', ('streams', ...), ('mp4Streams', ..., 'url'), ('oneVideoStreams', ..., 'url')),
            {url_or_none}, {update_url_query(query={'dzen_dash': []})})))
        for s_url in stream_urls:
            ext = determine_ext(s_url)
            content_type = traverse_obj(parse_qs(s_url), ('ct', 0))
            if ext == 'mpd' or content_type == '6':
                fmts, subs = self._extract_mpd_formats_and_subtitles(s_url, video_id, mpd_id='dash', fatal=False)
            elif ext == 'm3u8' or content_type == '8':
                fmts, subs = self._extract_m3u8_formats_and_subtitles(s_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
            elif content_type == '0':
                format_type = traverse_obj(parse_qs(s_url), ('type', 0))
                formats.append({
                    'url': s_url,
                    'format_id': format_type,
                    'ext': 'mp4',
                    'quality': quality(format_type),
                })
                continue
            else:
                self.report_warning(f'Unsupported stream URL: {s_url}{bug_reports_message()}')
                continue
            formats.extend(fmts)
            self._merge_subtitles(subs, target=subtitles)