[GH-ISSUE #491] Only 100 tracks in playlist #291

Closed
opened 2026-02-27 23:21:49 +03:00 by kerem · 3 comments
Owner

Originally created by @fepegar on GitHub (May 15, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/491

Hi,

I'm trying to retrieve all tracks in a playlist, but can get only 100:

import spotipy
import spotipy.util as util
from spotipy.oauth2 import SpotifyClientCredentials

credentials = SpotifyClientCredentials()
token = util.prompt_for_user_token(
    username='ferniss',
    scope='playlist-modify-private')
spotify = spotipy.Spotify(auth=token)
sp = spotify

uri = 'spotify:playlist:0kNHFNoDBVu9u8SpwgWTos'
username = 'ferniss'
playlist = sp.user_playlist(username, uri)

for idx, track_dict in enumerate(playlist['tracks']['items']):
    track = track_dict['track']
    features = sp.audio_features(track['uri'])[0]
    print(idx + 1, track['name'], features['tempo'])

Output:

1 Song To Say Goodbye 165.033
2 Strange Desire 129.405
3 Middle Brother 170.224
4 Barbara Ann - U.K. Remaster 79.258
5 Black Talk - Instrumental 133.413
[...]
90 Money For Nothing - Edit 134.238
91 Paradise City 100.26
92 Funk 49 92.478
93 Fear Of The Dark - 1998 Remastered Version 109.25
94 Bourée - 2001 Remaster 118.59
95 Am I Wrong 112.65
96 Alabama Song [Whisky Bar] - New Stereo Mix Advanced Resolution 173.974
97 Iron Man 156.654
98 People Are Strange 119.665
99 L'orage 125.682
100 La Tormenta 145.551

whereas this playlist has many more songs. Is this documented? Am I missing anything?

Originally created by @fepegar on GitHub (May 15, 2020). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/491 Hi, I'm trying to retrieve all tracks in a playlist, but can get only 100: ```python import spotipy import spotipy.util as util from spotipy.oauth2 import SpotifyClientCredentials credentials = SpotifyClientCredentials() token = util.prompt_for_user_token( username='ferniss', scope='playlist-modify-private') spotify = spotipy.Spotify(auth=token) sp = spotify uri = 'spotify:playlist:0kNHFNoDBVu9u8SpwgWTos' username = 'ferniss' playlist = sp.user_playlist(username, uri) for idx, track_dict in enumerate(playlist['tracks']['items']): track = track_dict['track'] features = sp.audio_features(track['uri'])[0] print(idx + 1, track['name'], features['tempo']) ``` Output: ``` 1 Song To Say Goodbye 165.033 2 Strange Desire 129.405 3 Middle Brother 170.224 4 Barbara Ann - U.K. Remaster 79.258 5 Black Talk - Instrumental 133.413 [...] 90 Money For Nothing - Edit 134.238 91 Paradise City 100.26 92 Funk 49 92.478 93 Fear Of The Dark - 1998 Remastered Version 109.25 94 Bourée - 2001 Remaster 118.59 95 Am I Wrong 112.65 96 Alabama Song [Whisky Bar] - New Stereo Mix Advanced Resolution 173.974 97 Iron Man 156.654 98 People Are Strange 119.665 99 L'orage 125.682 100 La Tormenta 145.551 ``` whereas this playlist has many more songs. Is this documented? Am I missing anything?
kerem closed this issue 2026-02-27 23:21:50 +03:00
Author
Owner

@stephanebruckert commented on GitHub (May 17, 2020):

@fepegar have a look at the playlist_tracks endpoint:

<!-- gh-comment-id:629843882 --> @stephanebruckert commented on GitHub (May 17, 2020): @fepegar have a look at the `playlist_tracks` endpoint: - doc https://spotipy.readthedocs.io/en/2.12.0/#spotipy.client.Spotify.playlist_tracks - example https://github.com/plamere/spotipy/blob/master/examples/playlist_tracks.py
Author
Owner

@fepegar commented on GitHub (May 17, 2020):

I see, thanks! I think that didn't exist back when I wrote my code. Isn't there a way to just get all the tracks?

<!-- gh-comment-id:629850232 --> @fepegar commented on GitHub (May 17, 2020): I see, thanks! I think that didn't exist back when I wrote my code. Isn't there a way to just get all the tracks?
Author
Owner

@stephanebruckert commented on GitHub (May 19, 2020):

@fepegar nope because a playlist can contain up to 11k tracks, it could possibly time out with so much data

<!-- gh-comment-id:631105186 --> @stephanebruckert commented on GitHub (May 19, 2020): @fepegar nope because a playlist can contain up to 11k tracks, it could possibly time out with so much data
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/spotipy#291
No description provided.