[GH-ISSUE #772] get_library_playlists does not honor limit= parameter #495

Closed
opened 2026-02-27 23:01:06 +03:00 by kerem · 6 comments
Owner

Originally created by @norbusan on GitHub (May 20, 2025).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/772

Describe the bug

ytmusic.get_library_playlists(limit=10)

seems to ignore the limit parameter, and returns the default 25 entries of playlists.

Worse, setting limit=None does not get all the playlists.

To Reproduce

from ytmusicapi import YTMusic, OAuthCredentials
ytmusic = YTMusic('oauth.json', oauth_credentials=OAuthCredentials(client_id=OAUTH_CLIENT_ID, client_secret=OAUTH_CLIENT_SECRET))
yt_playlists = ytmusic.get_library_playlists(limit=3)
print(len(yt_playlists))
Originally created by @norbusan on GitHub (May 20, 2025). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/772 **Describe the bug** ``` ytmusic.get_library_playlists(limit=10) ``` seems to ignore the `limit` parameter, and returns the default 25 entries of playlists. Worse, setting `limit=None` does *not* get all the playlists. **To Reproduce** ``` from ytmusicapi import YTMusic, OAuthCredentials ytmusic = YTMusic('oauth.json', oauth_credentials=OAuthCredentials(client_id=OAUTH_CLIENT_ID, client_secret=OAUTH_CLIENT_SECRET)) yt_playlists = ytmusic.get_library_playlists(limit=3) print(len(yt_playlists)) ```
kerem 2026-02-27 23:01:06 +03:00
  • closed this issue
  • added the
    invalid
    label
Author
Owner

@norbusan commented on GitHub (May 20, 2025):

In addition get_playlist also does not honor the limit parameter and seems to default to downloading at max 200 tracks.

<!-- gh-comment-id:2894328093 --> @norbusan commented on GitHub (May 20, 2025): In addition `get_playlist` also does not honor the limit parameter and seems to default to downloading at max 200 tracks.
Author
Owner

@sigma67 commented on GitHub (May 20, 2025):

Which version of ytmusicapi are you using?

<!-- gh-comment-id:2895682887 --> @sigma67 commented on GitHub (May 20, 2025): Which version of ytmusicapi are you using?
Author
Owner

@norbusan commented on GitHub (May 20, 2025):

❯ pip show ytmusicapi
Name: ytmusicapi
Version: 1.10.3
Summary: Unofficial API for YouTube Music
...
<!-- gh-comment-id:2895982983 --> @norbusan commented on GitHub (May 20, 2025): ``` ❯ pip show ytmusicapi Name: ytmusicapi Version: 1.10.3 Summary: Unofficial API for YouTube Music ... ```
Author
Owner

@sigma67 commented on GitHub (May 22, 2025):

So, about limit=3, please read the FAQ: https://ytmusicapi.readthedocs.io/en/stable/faq.html#why-is-ytmusicapi-returning-more-results-than-requested-with-the-limit-parameter

The second claim is simply not true, it does get all the playlists. If you still think it doesn't, please provide precise reproduction instructions including the playlist in question.

<!-- gh-comment-id:2902294657 --> @sigma67 commented on GitHub (May 22, 2025): So, about limit=3, please read the FAQ: https://ytmusicapi.readthedocs.io/en/stable/faq.html#why-is-ytmusicapi-returning-more-results-than-requested-with-the-limit-parameter The second claim is simply not true, it does get all the playlists. If you still think it doesn't, please provide precise reproduction instructions including the playlist in question.
Author
Owner

@norbusan commented on GitHub (May 22, 2025):

Thanks for the explanation, I now understand the pagination issue. I did expect that one can send a pagination number (via the limit= parameter) and I didn't know that the pagination is fixed. All fine with that.

Concerning the list of songs per playlist ... that is weird indeed.
I have several playlists where the number shown in the description and the actual number of items in the list differ!!!

E.g., one of my playlists: https://music.youtube.com/playlist?list=PLVNSEwvEH7u0lkwI_H6LUkUCArr7WWtCD&si=3rjtGoCkgvSyx0Oy

  • shows in the description that there are 24 tracks
  • counting the actual tracks listed only gives 21

The library gives the number of tracks as 21 - but I did trust the displayed number of 24 and was surprised.

No idea why this happens, but it happens for me for several playlists!!!!

<!-- gh-comment-id:2902729200 --> @norbusan commented on GitHub (May 22, 2025): Thanks for the explanation, I now understand the pagination issue. I did expect that one can send a pagination number (via the limit= parameter) and I didn't know that the pagination is fixed. All fine with that. Concerning the list of songs per playlist ... that is weird indeed. I have several playlists where the **number** shown in the **description** and the actual number of items in the list differ!!! E.g., one of my playlists: https://music.youtube.com/playlist?list=PLVNSEwvEH7u0lkwI_H6LUkUCArr7WWtCD&si=3rjtGoCkgvSyx0Oy * shows in the description that there are 24 tracks * counting the **actual** tracks listed only gives 21 The library gives the number of tracks as 21 - but I did trust the displayed number of 24 and was surprised. No idea why this happens, but it happens for me for several playlists!!!!
Author
Owner

@sigma67 commented on GitHub (May 23, 2025):

That would be a server side bug - nothing we can do about that. The job of this library is to actually reflect server state

<!-- gh-comment-id:2903396806 --> @sigma67 commented on GitHub (May 23, 2025): That would be a server side bug - nothing we can do about that. The job of this library is to actually reflect server state
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ytmusicapi#495
No description provided.