spotifylibspotifyspotify-appechonest

How to Look Up Spotify IDs (Song / Track IDs) in Bulk?


I have a list of songs - is there a way (using the Spotify / Echo Nest API) to look up the Spotify ID for each track in bulk?

If it helps, I am planning on running these IDs through the "Get Audio Features" part of their API.

Thanks in advance!


Solution

  • You can use the Spotify Web API to retrieve song IDS. First, you'll need to register to use the API. Then, you will need to perform searches, like in the example linked here.

    The Spotify API search will be most useful for you if you can provide specifics on albums and artists. The search API allows you to insert multiple query strings. Here is an example (Despacito by Justin Bieber:

    https://api.spotify.com/v1/search?q=track:"' + despacito + '"%20artist:"' + bieber + '"&type=track
    

    You can paste that into your browser and scan the response if you'd like. Ultimately you are interested in the song id, which you can find in the uri:

    spotify:track:6rPO02ozF3bM7NnOV4h6s2
    

    Whichever programming language you choose should allow you to loop through these calls to get the song IDs you want. Good luck!