Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Spotify Web API: How to get genres from TrackObject in playlist

Spotify Web API: How to get genres from TrackObject in playlist

I am using the Spotify Web API through Python. I am currently extracting tracks from a playlist. With that in mind, I also wanted to get the genres for each song.

 

My first question is if there's a way to a genre for a specific song? At the moment, I don't think there is but I could be mistaken.


Assuming there wasn't, I tried to get the genres for a song by keying in to each track. However, I noticed that there is no genre's key for any of the songs. I am using the the Top 100 songs, so I'd assume that these songs would have a genre. 

Here's what the 'artist' key returns for a given artist in a given song:

 

 [{'external_urls': {'spotify': 'https://open.spotify.com/artist/2LIk90788K0zvyj2JJVwkJ'}, 'href': 'https://api.spotify.com/v1/artists/2LIk90788K0zvyj2JJVwkJ', 'id': '2LIk90788K0zvyj2JJVwkJ', 'name': 'Jack Harlow', 'type': 'artist', 'uri': 'spotify:artist:2LIk90788K0zvyj2JJVwkJ'}]

This is the documentation I was looking at:

 

https://developer.spotify.com/documentation/web-api/reference/get-playlists-tracks

 

 

 

 

Reply
1 Reply

The Get Several Artists endpoint provides genres.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Suggested posts