✅ Help with SpotifyAPI
I'm trying to retrieve more than a 100 songs at once from a playlist in Spotify and I can't get it to work.
And I have no idea how to make that work.
No need to send code since I didn't start to write anything, ChatGPT suggested a few things but non of them worked.
Please help :)
Thanks in advance.
33 Replies
How are we supposed to help given the information you provided so far?
We don't provide support for the Spotify API
if i had to guess that's probably an intentional limitation of their API
their documentation should provide that information
The search endpoint explicitly states its limits
What else would want me to give you?
I couldn't find it
I also couldn't find a Discord server that provides such thing, so it makes sense to send it in the C# server. Someone PROBABLY used the SpotifyAPI in here.
If you literally Google "Spotify API search" it's the first hit lol
Let me rephrase my problem
Fixed it
you have to make multiple requests
Oof, isn't there a way to do it without multiple requests?
what does their documentation say
I added this line and it still returns a list with 100 and that's it.
I took this line from their docs.
so you're fetching something from their API, modifying the response, and expecting that to change the request that you already sent? i'm confused
Uhm.. You do understand that you are setting the value on it, after it has already been fetched
Yea I got that.
And just 1 thing, instead of pointing out my errors, why won't you help me?
Clearly I don't know very well what I'm doing, right? So help me. Don't be like that.
we're helping you right now?
If by "help" you mean "give me the code", thats not happening.
That's not I meant.
if that doesn't involve telling you what you're doing wrong, what is "helping" supposed to look like
if you're looking for someone to just hand you an answer, that's not how we do things here
If you don't understand something, ask about it. But try to ask specific questions.
Based on the above, it looks like you want to fetch the tracks of a given playlist. The API documentation for that is https://developer.spotify.com/documentation/web-api/reference/get-playlists-tracks
look at the API doc page, specifically where it says "limit"
and tell us what it says
Ok. I saw that, though you see at the top it's says
playlists/{playlistId}/tracks
?yep, thats the API path
Right, but in my code, in that certain (and only) line I see the
Playlists(id)
I don't quite understand where I should put the #Tracks
.do you have documentation for the C# API wrapper you're using?
I found this (right when I started working with that api) but I can't find what I need here.
https://johnnycrazy.github.io/SpotifyAPI-NET/
SpotifyAPI-NET | SpotifyAPI-NET
Documentation for the C# .NET SpotifyAPI-NET Library
GitHub
SpotifyAPI-NET/SpotifyAPI.Web/Clients/Interfaces/IPlaylistsClient.c...
:sound: A Client for the Spotify Web API, written in C#/.NET - JohnnyCrazy/SpotifyAPI-NET
there is an overload for that method that takes an object with additional options
that should let you do what you want, if not then you'll need to find a wrapper that exposes the parts of the API you need
but you still won't get more than 100 items at once, in fact i'm surprised you're getting that since spotify's documentation says the limit is 50
the API is what's called paginated, if you want more data you have to manipulate the
offset
and limit
options to get it in multiple partsthe wrapper you are using seems to be doing some of that work for you
https://johnnycrazy.github.io/SpotifyAPI-NET/docs/pagination
What's paginate?
ok nvm it's says it right here
so instead of just accessing
Items
directly, you're expected to use the Paginate
and PaginateAll
methods on the playlist.Tracks
So to answer this, it would have been very useful to link to the Spotify API wrapper you were using in your original post.
You didn't say anything about a wrapper, so I assumed you were using the API directlyOk, now I know that. Thanks Pobiega
the more information you provide, the better help you get
Yea, I just never thought about sending the wrapper link
Just saying it worked, thanks a lot and sorry if I wasn't clear at the beginning.
No worries, glad you got it working and hopefully learned how to better ask questions for next time 🙂
consider $close -ing this thread
Use the /close command to mark a forum thread as answered