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

Code before:

        return last_page

    def _extract_entries(self, webpage):
        tbody = self._search_regex(
            r'(?s)tbody\s+data-playlisting-add-entries[^>]*>(.+?)</tbody>', webpage, 'tbody')
        return [
            self.url_result(player_url, 'Youtube')
            for player_url in re.findall(r'href="([^"]+youtube.com/watch[^"]+)"', tbody)
        ]

    def _download_page(self, url, current_page_number, last_page_number, playlist_id):
        note = 'Downloading page'
        query = {}

        if last_page_number:
            note = '%s %d of %d' % (note, current_page_number, last_page_number)
            query['page'] = current_page_number

        return self._download_webpage(url, playlist_id, note, query=query)

    def _entries(self, url, playlist_id):
        webpage = self._download_webpage(url, playlist_id)
        current_page_number = self._extract_current_page(url)
        last_page_number = self._extract_last_page(webpage)
        start_page_number = current_page_number or 1
        end_page_number = last_page_number if last_page_number is not None else start_page_number

        for page_number in range(start_page_number, end_page_number + 1):
            webpage = self._download_page(url, page_number, last_page_number, playlist_id)
            page_entries = self._extract_entries(webpage)

            for e in page_entries:
                yield e

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


class LastFMAlbumIE(LastFMPlaylistBaseIE):
    _VALID_URL = r'https?://(?:www\.)?last\.fm/music/(?P<artist_id>[^/]+)/(?P<id>[^+/#?][^/#?]+)(/|[^/]*/?)$'
    _TESTS = [{
        'url': 'https://www.last.fm/music/Oasis/(What%27s+the+Story)+Morning+Glory%3F',
        'info_dict': {
            'id': '(What%27s+the+Story)+Morning+Glory%3F',
        },
        'playlist_count': 12,
    }]



Review comment (suggestion):
```suggestion
        start_page_number = current_page_number if current_page_number != None else 1
```

Code after:
            ]

            for e in page_entries:
                yield e

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


class LastFMPlaylistIE(LastFMPlaylistBaseIE):
    _VALID_URL = r'https?://(?:www\.)?last\.fm/(music|tag)/(?P<id>[^/]+)(?:/[^/]+)?/?(?:[?#]|$)'
    _TESTS = [{
        'url': 'https://www.last.fm/music/Oasis/(What%27s+the+Story)+Morning+Glory%3F',
        'info_dict': {
            'id': 'Oasis',
        },
        'playlist_count': 11,
    }, {
        'url': 'https://www.last.fm/music/Oasis',
        'only_matching': True,
    }, {
        'url': 'https://www.last.fm/music/Oasis/',
        'only_matching': True,
    }, {
        'url': 'https://www.last.fm/music/Oasis?top_tracks_date_preset=ALL#top-tracks',
        'only_matching': True,
    }, {
        'url': 'https://www.last.fm/music/Oasis/+tracks',
        'only_matching': True,
    }, {
        'url': 'https://www.last.fm/music/Oasis/+tracks?page=2',
        'only_matching': True,
    }, {
        'url': 'https://www.last.fm/music/Oasis/+tracks?date_preset=LAST_90_DAYS#top-tracks',
        'only_matching': True,
    }, {
        'url': 'https://www.last.fm/tag/rock',
        'only_matching': True,
    }, {
        'url': 'https://www.last.fm/tag/rock/tracks',
        'only_matching': True,
    }]


class LastFMUserIE(LastFMPlaylistBaseIE):
    _VALID_URL = r'https?://(?:www\.)?last\.fm/user/[^/]+/playlists/(?P<id>[^/#?]+)'
    _TESTS = [{
        'url': 'https://www.last.fm/user/mehq/playlists/12319471',
        'info_dict': {
            'id': '12319471',