2
votes

How do I get a "global" top tracks list on Spotify using the Spotify API ? What I mean is for example a list of the 20 most popular songs on Spotify now (for any artists/countries)

I already googled a lot and the only thing I could find is how to get a top tracks list for a specific artist which is not what I'm looking for at the moment.

Could anyone shed some light on it please ?

3

3 Answers

4
votes

https://spotifycharts.com/ seems to have the data you are looking for.

Top right there is a link to download the chart as a csv. You can just point your code to the url for the csv for easier programmable access.

The problem that this is not exposed in the official API is being discussed in https://github.com/spotify/web-api/issues/33

1
votes

You can also use the get-playlist endpoint to get the tracks of a playlist that has the most popular songs like Global Top 50:

curl -X "GET" "https://api.spotify.com/v1/playlists/37i9dQZEVXbMDoHDwVN2tF" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer XXX"

See the API docs: https://developer.spotify.com/console/get-playlist/

0
votes

You can use getCategoryPlaylists('toplists') method to get the top tracks. You can get the remaining categories by using the method getCategories. It will give you a list of categories they have such as Pop, rock and many more.

use this library to get all these functions.