mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #440] get_user_saved_tracks returning empty json #257
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#257
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 @zapell on GitHub (Feb 13, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/440
I am trying to get my spotify data using Spotipy but when i run:
and then
it returns empty json data.
The only time it work is when I do
top.current_user_top_artists(limit=10, time_range='long_term')but not with a different parameter value for time range.
@ritiek commented on GitHub (Feb 13, 2020):
Do you get the same behaviour when you try out the web API from https://developer.spotify.com/console/get-current-user-saved-tracks/ ?
@zapell commented on GitHub (Feb 13, 2020):
Thanks for the response! yea, I ran
curl -X "GET" "https://api.spotify.com/v1/e/tracks?limit=10&offset=0" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer <TOKEN>"(with my token in place )
It returns this:
{
"href" : "https://api.spotify.com/v1/me/tracks?offset=0&limit=10",
"items" : [ ],
"limit" : 10,
"next" : null,
"offset" : 0,
"previous" : null,
"total" : 0
I was rerunning this code from a couple months ago, where I had no trouble with this issue, so I am unsure of why it arose.
@ritiek commented on GitHub (Feb 14, 2020):
returns all tracks under "Favourite Songs" for the current user. You probably have not saved any tracks to your Favourite Songs, so it's returning empty.
Are you trying to fetch all tracks that the user has saved in all their playlists?
@zapell commented on GitHub (Feb 14, 2020):
Yes that is what I am trying to do. I ran this a couple months ago and it was returning my saved songs. I am trying to get all of my liked/saved tracks.
@ritiek commented on GitHub (Feb 14, 2020):
I don't see why it wouldn't work for you. It seems to good for me.
I have these 4 tracks favourited as in this screenshot:

and I can fetch them using spotipy with:
And the output is:
Is something like this what you're trying to do?
@zapell commented on GitHub (Feb 14, 2020):
Yea i just tried that code and it did not work for me. I'm wondering if I have my spotify app settings screwed up? I have the redirect url set to "http://localhost/"
@zapell commented on GitHub (Feb 14, 2020):
It's strange because when I do this I get all of my playlists returned.
playlists = sp.user_playlists(USERNAME) for playlist in playlists['items']: print("Name: {}, Number of songs: {}, Playlist ID: {} ". format(playlist['name'].encode('utf8'), playlist['tracks']['total'], playlist['id']))@ritiek commented on GitHub (Feb 14, 2020):
That's really weird.
I don't think that should be a problem. If other API methods work fine for you, then
current_user_saved_tracksshould work too.You should probably open an issue on Spotify's web-api repo and put a link to this issue in the description. Given that curl fails too https://github.com/plamere/spotipy/issues/440#issuecomment-585838433, this likely has something do with Spotify's side with
get-current-user-saved-tracksmethod not working as expected.@zapell commented on GitHub (Feb 14, 2020):
Ok, I just opened a new issue, thanks for the help
@stephanebruckert commented on GitHub (Feb 15, 2020):
@zapell since you managed to reproduce the issue with curl I'm going to close this because the problem is not related to python. Please make sure you add all the information needed to understand the issue in https://github.com/spotify/web-api/issues/1473 (without mentioning python).
Also try to double check: