diff --git a/tests/test.py b/tests/test.py index c284451..b55de41 100644 --- a/tests/test.py +++ b/tests/test.py @@ -69,15 +69,15 @@ class TestYTMusic(unittest.TestCase): self.assertGreater(len(playlists), 0) def test_get_library_songs(self): - songs = youtube_brand.get_library_songs(200) + songs = youtube_brand.get_library_songs(100) self.assertGreater(len(songs), 0) def test_get_library_albums(self): - albums = youtube_brand.get_library_albums(50) + albums = youtube_brand.get_library_albums(100) self.assertGreater(len(albums), 0) def test_get_library_artists(self): - artists = youtube_brand.get_library_artists(50) + artists = youtube_brand.get_library_artists(100) self.assertGreater(len(artists), 0) def test_get_library_subscriptions(self): diff --git a/ytmusicapi/parsers.py b/ytmusicapi/parsers.py index 2aa2903..ce78d71 100644 --- a/ytmusicapi/parsers.py +++ b/ytmusicapi/parsers.py @@ -310,16 +310,14 @@ def get_browse_id(item, index): def get_continuations(results, continuation_type, per_page, limit, request_func, parse_func): - request_count = 1 items = [] - while 'continuations' in results and request_count * per_page < limit: + while 'continuations' in results and len(items) < limit - per_page: ctoken = nav(results, CONTINUATION) additionalParams = "&ctoken=" + ctoken + "&continuation=" + ctoken response = request_func(additionalParams) results = response['continuationContents'][continuation_type] continuation_contents = 'contents' if 'Shelf' in continuation_type else 'items' items.extend(parse_func(results[continuation_contents])) - request_count += 1 return items