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

Code before:
        # Test that the playlist extractor finishes extracting when the
        # channel has more than one page of entries
        'url': 'https://zen.yandex.ru/tatyanareva',
        'info_dict': {
            'id': 'tatyanareva',
            'description': 'md5:92e56fa730a932ca2483ba5c2186ad96',
            'title': 'Татьяна Рева',
        },
        'playlist_mincount': 46,
    }, {
        'url': 'https://dzen.ru/id/606fd806cc13cb3c58c05cf5',
        'info_dict': {
            'id': '606fd806cc13cb3c58c05cf5',
            'title': 'AcademeG DailyStream',
            'description': 'md5:517b7c97d8ca92e940f5af65448fd928',
        },
        'playlist_mincount': 657,
    }]

    def _entries(self, feed_data, channel_id):
        next_page_id = None
        for page in itertools.count(1):
            for item in traverse_obj(feed_data, (
                (None, ('items', lambda _, v: v['tab'] in ('shorts', 'longs'))),
                'items', lambda _, v: v['link']),
            ):
                yield self.url_result(item['link'], ZenYandexIE, item.get('id'), title=item.get('title'))

            more = traverse_obj(feed_data, ('more', 'link', {url_or_none}))
            current_page_id = next_page_id
            next_page_id = traverse_obj(parse_qs(more), ('next_page_id', -1))
            if not all((more, next_page_id, next_page_id != current_page_id)):
                break

            feed_data = self._download_json(more, channel_id, note=f'Downloading Page {page}')

    def _real_extract(self, url):
        channel_id = self._match_id(url)
        channel_data = self._fetch_ssr_data(url, channel_id)['exportResponse']

        return self.playlist_result(
            self._entries(channel_data['feedData'], channel_id),
            channel_id, **traverse_obj(channel_data, ('channel', 'source', {
                'title': ('title', {str}),
                'description': ('description', {str}),
            })))


Review comment (suggestion):
```suggestion
                'items', lambda _, v: url_or_none(v['link']),
            )):
```

Code after:
        'playlist_count': 18,
    }, {
        # Test that the playlist extractor finishes extracting when the
        # channel has more than one page of entries
        'url': 'https://zen.yandex.ru/tatyanareva',
        'info_dict': {
            'id': 'tatyanareva',
            'description': 'md5:92e56fa730a932ca2483ba5c2186ad96',
            'title': 'Татьяна Рева',
        },
        'playlist_mincount': 46,
    }, {
        'url': 'https://dzen.ru/id/606fd806cc13cb3c58c05cf5',
        'info_dict': {
            'id': '606fd806cc13cb3c58c05cf5',
            'title': 'AcademeG DailyStream',
            'description': 'md5:517b7c97d8ca92e940f5af65448fd928',
        },
        'playlist_mincount': 657,
    }]

    def _entries(self, feed_data, channel_id):
        next_page_id = None
        for page in itertools.count(1):
            for item in traverse_obj(feed_data, (
                (None, ('items', lambda _, v: v['tab'] in ('shorts', 'longs'))),
                'items', lambda _, v: url_or_none(v['link']),
            )):
                yield self.url_result(item['link'], ZenYandexIE, item.get('id'), title=item.get('title'))

            more = traverse_obj(feed_data, ('more', 'link', {url_or_none}))
            current_page_id = next_page_id
            next_page_id = traverse_obj(parse_qs(more), ('next_page_id', -1))
            if not all((more, next_page_id, next_page_id != current_page_id)):
                break

            feed_data = self._download_json(more, channel_id, note=f'Downloading Page {page}')

    def _real_extract(self, url):
        channel_id = self._match_id(url)
        channel_id, ssr_data = self._fetch_ssr_data(url, channel_id)
        channel_data = ssr_data['exportResponse']

        return self.playlist_result(
            self._entries(channel_data['feedData'], channel_id),
            channel_id, **traverse_obj(channel_data, ('channel', 'source', {
                'title': ('title', {str}),
                'description': ('description', {str}),
            })))