4

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!

Zach
  • 750
  • 2
  • 13
  • 23

2 Answers2

5

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!

Trevor McCormick
  • 307
  • 1
  • 3
  • 11
0

It has been a few years, and I am curious how far you got with this project. I was doing the same thing around 2016 as well. I am just picking up the project again, and noticing you still cannot do large bulk ID queries by Artist,Title.

For now I am just handling HttpStatusCode 429 and sleeping the thread as I loop through a library. It's kind of slow but, I mean it gets the job done. After I get them I do the AudioFeatures query for 100 tracks at a time so it goes pretty quickly that way.

So far, this is the slowest part and I really wish there was a better way to do it, or even a way to make your own 'Audio Features' based on your library It just takes a lot of computing cycles. However ... one possible outcome might be to only do it for tracks that you cannot find on Spotify ;s

  • I did continue with the project but idk how much I can offer as you're doing a lot of what I did. A few tips though: if you have the web app, you can select tracks (ctrl, shift, select all, etc) and then drag them to a text editor, this will give you all of the track IDs. If you are just trying to build up as big of a database as possible then you might want to try scraping from the playlists endpoint -- I had a general query and just looped through each playlist and added all track info to a db. Otherwise, just keep on building requests with 100 tracks at a time and you should [CONT] – Zach Jul 17 '20 at 10:02
  • [...CONT] be able to accomplish most tasks. Spotify is pretty generous with their API, just find a nice request cadence and it should run pretty smoothly. I made over a billion requests over a few weeks and didn't have any issues with rate-limiting or blocking. But what do you mean by "making your own Audio Features based on your library"? – Zach Jul 17 '20 at 10:06
  • desktop app *** – Zach Jul 17 '20 at 10:08