mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #246] How do I get every track of a playlist? #129
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#129
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 @Kurchunk on GitHub (Jan 17, 2018).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/246
There are no code samples for this action, and I tried using an example for writing track names to a text file, but I noticed I am sometimes missing tracks if the playlist is over 100 tracks.
i.e. one playlist said the total was 106 tracks, but I only returned 100. But, I was able to get one playlist of over 800 tracks.
@ritiek commented on GitHub (Jan 18, 2018):
Not sure about your code but I've been using this for a long time and has been working fine for me so far:
@gawaineo commented on GitHub (Jan 19, 2018):
@CiniqueL
I believe the limit for the amount of tracks to be returned is 100 (check out the min and max track limit at the link below).
Source: https://developer.spotify.com/web-api/get-playlists-tracks/
I just wrote some code related to you question, below is an example:
Here's the link to the above method being called: http://spotipy.readthedocs.io/en/latest/#spotipy.client.Spotify.user_playlist_tracks
To get the
user_idandplaylist_id, I usedspot.me()and go into Spotify app and get the URI when you right-click for the "Share" button, respectively. I believe you can use another method inspotipylibrary to get the playlist's ID once you get the playlist URI.@Kurchunk commented on GitHub (Jan 20, 2018):
Thank you both for your answers.
I was able to find what I needed on StackOverflow. I'm still working out some other bugs in my script, but the code I'm using is:
I think the problem was that I was appending my list instead of extending it.
@AtomicNess123 commented on GitHub (Jul 1, 2021):
Thank you! How to modify this to just get the id of the tracks?
I tried
tracks = results['items'][0]['track']['id']unsuccessfully.@marcraft2 commented on GitHub (Aug 3, 2021):
With that no limit!
username => user id, in profile link
playlist id => in playlist link
@kunal-jangid commented on GitHub (Apr 11, 2023):
I got a doubt, what's username here? Like let's say I want to use random playlist as playlist id. Then what would I use as a username? Would it be mine or would it the creator of the playlist?
@stephanebruckert commented on GitHub (Apr 11, 2023):
user_playlist_tracksis deprecated, you need to useplaylist_tracks(without username)