mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #938] Get user's playlists in their library #563
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#563
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @WestheadJ on GitHub (Feb 2, 2023).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/938
Where can I get all the playlists in a user's library, I tried to use the
user_playlistsmethod and it only gets 22 results, my library has 40+ playlists, self created and not.@mase-git commented on GitHub (Feb 2, 2023):
Can you post the your snippet of code about the user_playlists invocation? I tried on an account with 40+ playlists and it works, considering the 50 limit given by Spotify API constraint. Did you even try to run user_playlists example?
@WestheadJ commented on GitHub (Feb 3, 2023):
Yes I used the method, still shows 22 results.

@dieser-niko commented on GitHub (Feb 3, 2023):
I think I figured out what the problem is. You have not authenticated with your account. You can't see the other playlists because they are not publicly viewable on your profile.
What kind of auth manager are you using?
@WestheadJ commented on GitHub (Feb 3, 2023):
@mase-git commented on GitHub (Feb 3, 2023):
I tried with the Spotify account (it has more than 50+ public playlists) and it works as you can see from the following outputs:
Output:
It shows the first 50 playlists because of the default limit. So, the problem is not Spotipy.
Are you sure that your playlist are correctly reachable in a public way? Spotify provides a private mode for personal playlists which let them visible only for the owner account and invited friends. spotipy.client.user_playlists follows a scope that can't shows this kind of playlists. Maybe, the problem is linked to that.
If you want to show your private and public playlists you have to use spotipy.client.current_user_playlists and login with your account.
@dieser-niko commented on GitHub (Feb 3, 2023):
Not sure about that. I only have two public playlists but with the scope
playlist-read-privateall my private playlists appear.@WestheadJ can you check your scopes?
@WestheadJ commented on GitHub (Feb 3, 2023):
Yes, scope was incorrect thank you, I look dumb now
@mase-git commented on GitHub (Feb 3, 2023):
I didn't know that, you can also visualize private playlists without specify the explicit scope for the spotipy.client.user_playlists. So, there is no difference between spotipy.client.user_playlists(your_username) and spotipy.client.current_user_playlists with your_username your own account, right?
Thank you for the info
@WestheadJ commented on GitHub (Feb 3, 2023):
Yes, I tried both methods and only displays public playlists and I think if I can remember it also doesn't show saved playlists you liked made by Spotify i.e This Is Arctic Monkeys, you specifically need the scope declaration even if it's a personal account, makes sense due to Spotify authentication, I just didn't know it was part of the scope that needed to be added, if you see below I thought that the playlist-modify-private, would give access to read the private playlists too due to being able to modify them.

If anything it's an issue with Spotify's authentication scope, as you need to put multiple scopes in instead of being able to select a scope that uses a group of scopes i.e playlist scope but ah well. Thanks @dieser-niko and thanks anyone else for contributing my question
@WestheadJ commented on GitHub (Feb 3, 2023):
I there a way to get the other half of the playlists i.e if there's 50 playlists it selects and there's say 65, can you get the extra 15 or does Spotify's API not allow this
@mase-git commented on GitHub (Feb 3, 2023):
Yes, you can use the offset parameter and shift the 50 results to n units. For instance, if you have limit to 50 and offset to 10, you will visualize the list of items between 10 and 60. This feature is normalize for any kind of items inside the Spotipy.
@WestheadJ commented on GitHub (Feb 3, 2023):
Just realised one of the scopes is to show collab playlists, without it the 'next' value in the response was None, when adding it, I can therefore do the next