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

Code before:
        'playlist_mincount': 100,
        'info_dict': {
            'id': '479',
            'title': 'KubeCon + CloudNativeCon Europe\'19',
        },
    }]

    def _get_category_page(self, category_id, org_id, page=1, note=None):
        return self._download_json(
            f'https://analytics.videoken.com/api/videolake/{org_id}/category_videos', category_id,
            fatal=False, note=note if note else f'Downloading category page {page}',
            query={
                'category_id': category_id,
                'page_number': page,
                'length': '12',
            }, headers={'Accept': 'application/json'}) or {}

    def _entries(self, category_id, org_id, url):
        for page in itertools.count(1):
            videos = self._get_category_page(category_id, org_id, page)
            is_last_page = videos.get('is_last_page')
            if is_last_page is None:
                break
            yield from self._extract_videos(videos, url)
            if is_last_page:
                break

    def _real_extract(self, url):
        hostname, category_id = self._match_valid_url(url).group('host', 'id')
        org_id, _ = self._get_org_id_and_api_key(self._ORGANIZATIONS[hostname], category_id)
        category = self._get_category_page(
            category_id, org_id, note='Downloading category info')['category_name']
        return self.playlist_result(
            self._entries(category_id, org_id, url), category_id, category)


class VideoKenTopicIE(VideoKenBaseIE):
    _VALID_URL = VideoKenBaseIE._BASE_URL_RE + r'topic/(?P<id>[^/#?]+)/?(?:$|[?#])'
    _TESTS = [{
        'url': 'https://videos.neurips.cc/topic/machine%20learning/',
        'playlist_mincount': 100,
        'info_dict': {
            'id': 'machine%20learning',
            'title': 'machine learning',
        },
    }, {
        'url': 'https://videos.icts.res.in/topic/gravitational%20waves/',
        'playlist_mincount': 77,
        'info_dict': {
            'id': 'gravitational%20waves',
            'title': 'gravitational waves'

Review comment (refactor):
Is this not enough?

```suggestion
            yield from self._extract_videos(videos, url)
            if videos.get('is_last_page') is not False:
                break
```

Code after:
    }, {
        'url': 'https://videos.cncf.io/category/479/',
        'playlist_mincount': 328,
        'info_dict': {
            'id': '479',
            'title': 'KubeCon + CloudNativeCon Europe\'19',
        },
    }]

    def _get_category_page(self, category_id, org_id, page=1, note=None):
        return self._download_json(
            f'https://analytics.videoken.com/api/videolake/{org_id}/category_videos', category_id,
            fatal=False, note=note if note else f'Downloading category page {page}',
            query={
                'category_id': category_id,
                'page_number': page,
                'length': self._PAGE_SIZE,
            }, headers={'Accept': 'application/json'}) or {}

    def _entries(self, category_id, org_id, url, page):
        videos = self._get_category_page(category_id, org_id, page + 1)
        yield from self._extract_videos(videos, url)

    def _real_extract(self, url):
        hostname, category_id = self._match_valid_url(url).group('host', 'id')
        org_id, _ = self._get_org_id_and_api_key(self._ORGANIZATIONS[hostname], category_id)
        category_info = self._get_category_page(category_id, org_id, note='Downloading category info')
        category = category_info['category_name']
        total_pages = math.ceil(int(category_info['recordsTotal']) / self._PAGE_SIZE)
        return self.playlist_result(InAdvancePagedList(
            functools.partial(self._entries, category_id, org_id, url),
            total_pages, self._PAGE_SIZE), category_id, category)


class VideoKenTopicIE(VideoKenBaseIE):
    _VALID_URL = VideoKenBaseIE._BASE_URL_RE + r'topic/(?P<id>[^/#?]+)/?(?:$|[?#])'
    _TESTS = [{
        'url': 'https://videos.neurips.cc/topic/machine%20learning/',
        'playlist_mincount': 500,
        'info_dict': {
            'id': 'machine_learning',
            'title': 'machine learning',
        },
    }, {
        'url': 'https://videos.icts.res.in/topic/gravitational%20waves/',
        'playlist_mincount': 77,
        'info_dict': {
            'id': 'gravitational_waves',
            'title': 'gravitational waves'
        },
    }, {