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

Code before:
        res = self.url_result('https://archive.org/details/youtube-%s' % video_id, ArchiveOrgIE)
        # Extractor indirection doesn't allow merging info from the original extractor.
        # Youtube view count or thumbnail extracted from altcensored can't be merge back
        # into underlying archive.org info json
        return res


class AltCensoredChannelIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)altcensored\.com/channel/(?P<id>[^/?#]+)'
    _PAGE_SIZE = 24
    _TESTS = [{
        'url': 'https://www.altcensored.com/channel/UCFPTO55xxHqFqkzRZHu4kcw',
        'info_dict': {
            'title': 'Virginie Vota Channel (91 Censored Videos)',
            'id': 'UCFPTO55xxHqFqkzRZHu4kcw',
        },
        'playlist_count': 91
    }]

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

        webpage = self._download_webpage(url, channel_id, note='Download channel info',
                                         errnote='Unable to get channel info')
        title = self._html_search_meta('og:title', webpage)
        page_count = int(self._html_search_regex(r'<a href="/channel/\w+/page/(\d+)">(?:\1)</a>', webpage, 'page count'))

        def page_func(page_num):
            webpage = self._download_webpage(
                'https://altcensored.com/channel/%s/page/%d' % (channel_id, page_num + 1),
                channel_id, note='Download page #%d' % (page_num + 1),
                errnote='Unable to get page #%d' % (page_num + 1),
            )

            items = re.findall(r'<a[^>]+href="(/watch\?v=[^"]+)', webpage)
            # deduplicate consecutive items (multiple <a> per video)
            items = [self.url_result('https://www.altcensored.com' + key, AltCensoredIE) for key, _group in groupby(items)]
            return items

        entries = InAdvancePagedList(page_func, page_count, self._PAGE_SIZE)
        return self.playlist_result(entries, playlist_id=channel_id, playlist_title=title)


Review comment (suggestion):
This does not work with channels that only have a single page. `int_or_none` from `..utils` should also be used instead of `int`.
```suggestion
        page_count = int_or_none(self._html_search_regex(
            r'<a[^>]+href="/channel/\w+/page/(\d+)">(?:\1)</a>', webpage, 'page count', default='1'))
```
Add a case where a channel has a single page to the tests.

Code after:
        }
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)

        return {
            '_type': 'url_transparent',
            'url': f'https://archive.org/details/youtube-{video_id}',
            'ie_key': ArchiveOrgIE.ie_key(),
            'view_count': str_to_int(self._html_search_regex(
                r'YouTube Views:(?:\s|&nbsp;)*([\d,]+)', webpage, 'view count', default=None)),
            'categories': self._html_search_regex(
                r'<a href="/category/\d+">\s*\n?\s*([^<]+)</a>',
                webpage, 'category', default='').split() or None,
        }


class AltCensoredChannelIE(InfoExtractor):
    IE_NAME = 'altcensored:channel'
    _VALID_URL = r'https?://(?:www\.)?altcensored\.com/channel/(?!page|table)(?P<id>[^/?#]+)'
    _PAGE_SIZE = 24
    _TESTS = [{
        'url': 'https://www.altcensored.com/channel/UCFPTO55xxHqFqkzRZHu4kcw',
        'info_dict': {
            'title': 'Virginie Vota',
            'id': 'UCFPTO55xxHqFqkzRZHu4kcw',
        },
        'playlist_count': 91
    }, {
        'url': 'https://altcensored.com/channel/UC9CcJ96HKMWn0LZlcxlpFTw',
        'info_dict': {
            'title': 'yukikaze775',
            'id': 'UC9CcJ96HKMWn0LZlcxlpFTw',
        },
        'playlist_count': 4
    }]

    def _real_extract(self, url):
        channel_id = self._match_id(url)
        webpage = self._download_webpage(
            url, channel_id, 'Download channel webpage', 'Unable to get channel webpage')
        title = self._html_search_meta('altcen_title', webpage, 'title', fatal=False)
        page_count = int_or_none(self._html_search_regex(
            r'<a[^>]+href="/channel/\w+/page/(\d+)">(?:\1)</a>',
            webpage, 'page count', default='1'))

        def page_func(page_num):
            page_num += 1
            webpage = self._download_webpage(