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

Code before:
        return self._download_json(
            f'https://lp3test.polskieradio.pl/{path}', video_id, note,
            query=query, headers={'x-api-key': '9bf6c5a2-a7d0-4980-9ed7-a3f7291f2a81'})

    def _entries(self, playlist_id, has_episodes, has_articles):
        if has_episodes:
            not_empty = True
            i = 0
            while not_empty:
                page = self._call_lp3(
                    'AudioArticle/GetListByCategoryId', {
                        'categoryId': playlist_id,
                        'PageSize': 10,
                        'skip': i,
                        'format': 400,
                    }, playlist_id, f'Downloading episode list (page #{i})')
                for episode in page['data']:
                    yield {
                        'id': str(episode['id']),
                        'title': episode['title'],
                        'url': episode['file'],
                        'duration': int_or_none(episode.get('duration')),
                        'timestamp': parse_iso8601(episode.get('datePublic')),
                    }
                not_empty = len(page['data']) > 0
                i += 1

        if has_articles:
            not_empty = True
            i = 0
            while not_empty:
                page = self._call_lp3(
                    'Article/GetListByCategoryId', {
                        'categoryId': playlist_id,
                        'PageSize': 9,
                        'skip': i,
                        'format': 400,
                    }, playlist_id, f'Downloading article list (page #{i})')
                for article in page['data']:
                    yield {
                        '_type': 'url_transparent',
                        'id': str(article['id']),
                        'title': article['shortTitle'],
                        'url': article['url'],
                        'ie_key': PolskieRadioIE,
                        'description': traverse_obj(article, ('description', 'lead')),
                        'timestamp': parse_iso8601(article.get('datePublic')),
                    }
                not_empty = len(page['data']) > 0
                i += 1


Review comment (suggestion):
```suggestion
        for i in itertools.count(1) if has_episodes else []:
            page = self._call_lp3(
                'AudioArticle/GetListByCategoryId', {
                    'categoryId': playlist_id,
                    'PageSize': 10,
                    'skip': i,
                    'format': 400,
                }, playlist_id, f'Downloading episode list page {i}')
            if not traverse_obj(page, 'data'):
                break
            for episode in page['data']:
                yield {
                    'id': str(episode['id']),
                    'title': episode['title'],
                    'url': episode['file'],
                    'duration': int_or_none(episode.get('duration')),
                    'timestamp': parse_iso8601(episode.get('datePublic')),
                }
```

Code after:
            f'https://lp3test.polskieradio.pl/{path}', video_id, note,
            query=query, headers={'x-api-key': '9bf6c5a2-a7d0-4980-9ed7-a3f7291f2a81'})

    def _entries(self, playlist_id, has_episodes, has_articles):
        for i in itertools.count(1) if has_episodes else []:
            page = self._call_lp3(
                'AudioArticle/GetListByCategoryId', {
                    'categoryId': playlist_id,
                    'PageSize': 10,
                    'skip': i,
                    'format': 400,
                }, playlist_id, f'Downloading episode list page {i}')
            if not traverse_obj(page, 'data'):
                break
            for episode in page['data']:
                yield {
                    'id': str(episode['id']),
                    'url': episode['file'],
                    'title': episode.get('title'),
                    'duration': int_or_none(episode.get('duration')),
                    'timestamp': parse_iso8601(episode.get('datePublic')),
                }

        for i in itertools.count(1) if has_articles else []:
            page = self._call_lp3(
                'Article/GetListByCategoryId', {
                    'categoryId': playlist_id,
                    'PageSize': 9,
                    'skip': i,
                    'format': 400,
                }, playlist_id, f'Downloading article list page {i}')
            if not traverse_obj(page, 'data'):
                break
            for article in page['data']:
                yield {
                    '_type': 'url_transparent',
                    'ie_key': PolskieRadioIE.ie_key(),
                    'id': str(article['id']),
                    'url': article['url'],
                    'title': article.get('shortTitle'),
                    'description': traverse_obj(article, ('description', 'lead')),
                    'timestamp': parse_iso8601(article.get('datePublic')),
                }

    def _real_extract(self, url):
        playlist_id = self._match_id(url)

        page_props = traverse_obj(
            self._search_nextjs_data(self._download_webpage(url, playlist_id), playlist_id),
            ('props', 'pageProps', ('data', None)), get_all=False)