I want to create Spotify desktop app in Python, but I read API docs and I can not find anything about getting song stream to play it in my app. In docs there's statement that says the API responses are always in json format. So is there any way to play song through API?
Asked
Active
Viewed 902 times
0
-
Looking at their API page, No. It says: `Based on simple REST principles, the Spotify Web API endpoints return JSON metadata about music artists, albums, and tracks, directly from the Spotify Data Catalogue`. So metadata, nothing about songs. – The Pjot Aug 15 '18 at 14:09
-
As I thought, but I've seen some stream or yt video where some guy was making his Spotify client in c++, however I can not find it – sober Aug 15 '18 at 15:22
1 Answers
0
I have not worked with spotify api, but from a quick glance at the API docs you should be able to use this https://developer.spotify.com/documentation/web-api/reference/tracks/get-track/
set is_playable to True and you should be able to play it.
Code I would do:
import requests
headers = {
'Authorization': 'Bearer {your access token}',
}
response = requests.get('https://api.spotify.com/v1/tracks/11dFghVXANMlKmJXsNCbNl', headers=headers)
is_playable field will be returned back in the GET call.

RustyShackleford
- 3,462
- 9
- 40
- 81