-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting more than 100 tracks via getPlaylist #105
Comments
+1 |
If you use the
call instead, you can feed in options with a map. You can edit your code like this (probably)
And get litterally (two) tousands of tracks. Probably a good idea to limit it to do several calls and not set the limit too high and use the offset Edit: Actually the limit cannot be set higher than 100, you will have to do multiple calls with offset. |
Hi there, Just wanted to reply to say thank you for the info. I haven't had a chance to try this out yet as I have barely even been at my PC over the last couple of weeks. I will report back once I have tried out and hopefully we can close this :) |
If you'd like to fetch all tracks in the playlist you should use The response of this call is a paging object that has the So for a playlists with 268 tracks a simplified example could look like this: Map<String, Object> options = new Map<String, Object>();
options.put(SpotifyService.LIMIT, 100);
// get tracks 0-99
options.put(SpotifyService.OFFSET, 0);
Pager<PlaylistTrack> response = spotifyService.getPlaylistTracks(userId, playlistId, options);
// get tracks 100-199
options.put(SpotifyService.OFFSET, 100);
Pager<PlaylistTrack> response = spotifyService.getPlaylistTracks(userId, playlistId, options);
// get tracks 200-268
options.put(SpotifyService.OFFSET, 200);
Pager<PlaylistTrack> response = spotifyService.getPlaylistTracks(userId, playlistId, options); Where you can keep querying as long as |
Hi there,
Apologies if this isn't the correct place to ask.
I'm trying to get all track from a playlist and the playlist has more than 100 tracks within. Using the code below, I am able to get the first 100 tracks, but despite my efforts I am unable to figure out how to get the next 100 (or increase the limit). Could you tell me how to get all tracks, even if there are, say, thousands?
The text was updated successfully, but these errors were encountered: