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

Code before:
            playlist_id, f'Downloading page {page + 1}', query={
                'premium': False,
                'live': False,
                'limit': self._PAGE_SIZE,
                'offset': page * self._PAGE_SIZE,
            })

        for video_id in traverse_obj(creatives, ('items', ..., 'id', {str})):
            yield self.url_result(f'{self._BASE_URL}/creative/{video_id}', LocipoIE)

    def _real_extract(self, url):
        playlist_type, playlist_id = self._match_valid_url(url).group('type', 'id')
        if urlh := self._request_webpage(HEADRequest(url), playlist_id, fatal=False):
            playlist_type, playlist_id = self._match_valid_url(urlh.url).group('type', 'id')

        path = 'playlists' if playlist_type == 'playlist' else 'series'
        creatives = self._call_api(
            f'{path}/{playlist_id}/creatives', playlist_id, path.capitalize())

        return self.playlist_result(InAdvancePagedList(
            functools.partial(self._fetch_page, path, playlist_id),
            math.ceil(int(creatives['total']) / self._PAGE_SIZE), self._PAGE_SIZE,
        ), playlist_id, **traverse_obj(creatives, ('items', ..., playlist_type, {
            'title': ('name', {clean_html}, filter),
            'description': ('description', {clean_html}, filter),
        }, any)))


Review comment (suggestion):
I would break this up for readability
```suggestion
        entries = InAdvancePagedList(
            functools.partial(self._fetch_page, path, playlist_id),
            math.ceil(int(creatives['total']) / self._PAGE_SIZE), self._PAGE_SIZE)

        return self.playlist_result(
            entries, playlist_id,
            **traverse_obj(creatives, ('items', ..., playlist_type, {
                'title': ('name', {clean_html}, filter),
                'description': ('description', {clean_html}, filter),
            }, any)))
```

Code after:
        creatives = self._download_json(
            f'{self._API_BASE}/{path}/{playlist_id}/creatives',
            playlist_id, f'Downloading page {page + 1}', query={
                'premium': False,
                'live': False,
                'limit': self._PAGE_SIZE,
                'offset': page * self._PAGE_SIZE,
            })

        for video_id in traverse_obj(creatives, ('items', ..., 'id', {str})):
            yield self.url_result(f'{self._BASE_URL}/creative/{video_id}', LocipoIE)

    def _real_extract(self, url):
        playlist_type, playlist_id = self._match_valid_url(url).group('type', 'id')
        if urlh := self._request_webpage(HEADRequest(url), playlist_id, fatal=False):
            playlist_type, playlist_id = self._match_valid_url(urlh.url).group('type', 'id')

        path = 'playlists' if playlist_type == 'playlist' else 'series'
        creatives = self._call_api(
            f'{path}/{playlist_id}/creatives', playlist_id, path.capitalize())

        entries = InAdvancePagedList(
            functools.partial(self._fetch_page, path, playlist_id),
            math.ceil(int(creatives['total']) / self._PAGE_SIZE), self._PAGE_SIZE)

        return self.playlist_result(
            entries, playlist_id,
            **traverse_obj(creatives, ('items', ..., playlist_type, {
                'title': ('name', {clean_html}, filter),
                'description': ('description', {clean_html}, filter),
            }, any)))