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

Code before:
        'playlist_mincount': 9,
    }]
    _PAGE_SIZE = 30

    def _call_api(self, host, uuid, path, note=None, errnote=None, fatal=True):
        return self._download_json(
            self._API_BASE % (host, uuid, path), uuid,
            note=note, errnote=errnote, fatal=fatal)

    def _fetch_page(self, host, uuid, page):
        page += 1
        video_data = self._call_api(
            host, uuid, f'/videos?sort=-createdAt&start={self._PAGE_SIZE * (page - 1)}&count={self._PAGE_SIZE}',
            note=f'Downloading page {page}').get('data', [])
        for video in video_data:
            shortUUID = try_get(video, lambda x: x['video']['shortUUID'])
            video_title = try_get(video, lambda x: x['video']['name'])
            yield self.url_result(
                f'https://{host}/w/{shortUUID}', PeerTubeIE.ie_key(),
                video_id=shortUUID, video_title=video_title)

    def _real_extract(self, url):
        mobj = self._match_valid_url(url)
        host = mobj.group('host')
        playlist_id = mobj.group('id')

        playlist_info = self._call_api(host, playlist_id, '', note='Downloading playlist information', fatal=False)

        playlist_title = playlist_info.get('displayName')
        playlist_description = playlist_info.get('description')
        playlist_timestamp = unified_timestamp(playlist_info.get('createdAt'))
        channel = try_get(playlist_info, lambda x: x['ownerAccount']['name'])
        channel_id = try_get(playlist_info, lambda x: x['ownerAccount']['id'])
        thumbnail = playlist_info.get('thumbnailPath')
        thumbnail = f'https://{host}{thumbnail}'

        entries = OnDemandPagedList(functools.partial(
            self._fetch_page, host, playlist_id), self._PAGE_SIZE)

        return self.playlist_result(
            entries, playlist_id, playlist_title, playlist_description,
            timestamp=playlist_timestamp, channel=channel, channel_id=channel_id, thumbnail=thumbnail)


Review comment (suggestion):
```suggestion
        host, playlist_id = self._match_valid_url(url).group('host', 'id')
```

Code after:
        'playlist_mincount': 9,
    }]
    _PAGE_SIZE = 30

    def _call_api(self, host, uuid, path, note=None, errnote=None, fatal=True):
        return self._download_json(
            self._API_BASE % (host, uuid, path), uuid,
            note=note, errnote=errnote, fatal=fatal)

    def _fetch_page(self, host, uuid, page):
        page += 1
        video_data = self._call_api(
            host, uuid, f'/videos?sort=-createdAt&start={self._PAGE_SIZE * (page - 1)}&count={self._PAGE_SIZE}',
            note=f'Downloading page {page}').get('data', [])
        for video in video_data:
            shortUUID = try_get(video, lambda x: x['video']['shortUUID'])
            video_title = try_get(video, lambda x: x['video']['name'])
            yield self.url_result(
                f'https://{host}/w/{shortUUID}', PeerTubeIE.ie_key(),
                video_id=shortUUID, video_title=video_title)

    def _real_extract(self, url):
        host, playlist_id = self._match_valid_url(url).group('host', 'id')
        playlist_info = self._call_api(host, playlist_id, '', note='Downloading playlist information', fatal=False)

        playlist_title = playlist_info.get('displayName')
        playlist_description = playlist_info.get('description')
        playlist_timestamp = unified_timestamp(playlist_info.get('createdAt'))
        channel = try_get(playlist_info, lambda x: x['ownerAccount']['name'])
        channel_id = try_get(playlist_info, lambda x: x['ownerAccount']['id'])
        thumbnail = playlist_info.get('thumbnailPath')
        thumbnail = f'https://{host}{thumbnail}'

        entries = OnDemandPagedList(functools.partial(
            self._fetch_page, host, playlist_id), self._PAGE_SIZE)

        return self.playlist_result(
            entries, playlist_id, playlist_title, playlist_description,
            timestamp=playlist_timestamp, channel=channel, channel_id=channel_id, thumbnail=thumbnail)