Closed Srijha09 closed 3 years ago
https://api.spotify.com/v1/users/{user_id}/player/recently-played?limit={limit}
This endpoint does not exist. That's your first problem. Why don't you use the spotipy library instead of making the requests manually?
:param user_id: the Spotify User ID when a user gets authenticated in Spotify
Spotify does not return the user id during the authentication process.
Oh okay. Yes sure, i'll do that. Also, is there a way where I can retrieve any user's recently played songs when they login through my Flask application?
Use this method to retrieve the user's recently played tracks: https://github.com/plamere/spotipy/blob/06551cd0553d6e030f3f4ee7da5fac12c424bac7/spotipy/client.py#L1432
See this example for how to use spotipy with flask.
Thanks alot!
Hi, is it possible to get recently played tracks from other user by using their user id when the login through my application? Since this API endpoint is only for the current user https://api.spotify.com/v1/me/player/recently-played?limit={limit} ?
No, you can only get the recently played tracks for the current user. The spotipy documentation describes all of the available endpoints. You should also read the Spotify web API reference. If you don't see what you're looking for on those pages, then it's not possible.
Oh okay. Thanks
Hi, since I'm new to APIs, I'm trying to get accustomed to using Spotify API for creating a Flask Application. I got a key error when i was trying to extract a user's recently played tracks. I am not able to identify why this error occured. Could you please let me the the cause of the error? Below is the code
Flask app