mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #322] How to get more than 100 track ids on using spotipy? #184
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#184
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 @ghost on GitHub (Oct 2, 2018).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/322
I am trying to get do audio analyze similar to this guy: https://opendatascience.com/a-machine-learning-deep-dive-into-my-spotify-data/
However, when I try to do the same on mine machine, I could only get data from 100 tracks. Yet, I have 1000 tracks.
I tried to use the code from stack overflow: "using while loop and extends the list"
but, I am having a hard time to "extract" the song id from the playlist.
Does anyone know how to do this?
@alexthescott commented on GitHub (Oct 4, 2018):
Assuming you have already created a Spotify object, you can use these two functions in conjunction to create an array of Ids from a playlist. Spotify uses a paging object which stores 100 tracks on a page, with URLs to the next and previous pages. I chose to create two functions to help "flip" the pages. I've run a program similar to this one (collecting URIs) and I was able to get through a playlist with 1600 songs. Let me know if you need anything else!
https://developer.spotify.com/documentation/web-api/reference/object-model/#paging-object
@ghost commented on GitHub (Oct 5, 2018):
Thank you so much for the reply!
I understand whats the code trying to do, but once i implement it, i got this error.
But I don't understand what it mean.
@alexthescott commented on GitHub (Oct 5, 2018):
Sorry thats a JSON error on my part. Useful to print the entire track object to see what information it holds, but the code below solves your problem!
ids.append(track['track']['id'])
@ghost commented on GitHub (Oct 6, 2018):
Thank you!
try it on small playlist it works, but when I tried on the big playlist it gives me this error.
I am so new with python, so I don't really know what's going on.

@alexthescott commented on GitHub (Oct 6, 2018):
Alright I just debugged a little and rewrote the paginating id request. I ran it on my playlist of 1600 and had no issues!