Reputation: 322
I get a college task , to get recently played song using Spotify API and Python language. the problem is i just can get MY recently played song only. The task is getting other's too.
This my code so far:
import requests
response =requests.get("https://api.spotify.com/v1/me/player/recently-played",
headers={"Content-Type":"application/json",
"Authorization":"Bearer TOKEN"})
json_response = response.json()
for i in json_response['items']:
print(i["track"]['name'])
Upvotes: 0
Views: 929
Reputation: 426
I have not worked with the Spotify API previously, but it seems that all you should need to do is to change the token to the token of the user you are trying to get the recently played song of. It should not be possible to get the recently played songs of other users without some form of authentication. As long as you are provided with the token of the other users of course.
Upvotes: 2