Pagination issue for getUserPlaylists()
Cal-culator opened this issue · 4 comments
Cal-culator commented
Spotify, by default, limits the length of the playlist array to 20. Using getUserPlaylists() function only returns 20 playlists.
simondebbarma commented
Kinda funny we both have the same query. I tried using { limit : 50, offset : 50 }
as recommended in the docs but I'm getting the following error.
Unhandled Runtime Error
WebapiRegularError: An error occurred while communicating with Spotify's Web API.
Details: No token provided.
I would like to know how to get ALL user playlists.
simondebbarma commented
Welp, figured it out 5 minutes after typing the above.
Do something like this.
spotifyApi.getUserPlaylists({ limit: 50, offset: 0 })
Then you can write logic to increase the offset by 50 everytime until you reach the end of the playlists. The limit max is 50 tho.
Cal-culator commented
Ah ok. This is really helpful! Thanks a lot!
lucasrmagalhaes commented
@simondebbarma thanks!