Fetching ISRCs from Spotify

Tags: #<Tag:0x00007f0509564d88> #<Tag:0x00007f0509564c48> #<Tag:0x00007f0509564b08>


ISRCs are often difficult to find without CDs, and one of the best resources I’ve found for them is that of Spotify. However they can only be retrieved using the API service in JSON, which is far from easy to read or navigate.

That’s why I made a simple script/HTML page to retrieve data from the service and displays it in a readily readable format. It can perform searches or lookups by artist or album. Track isn’t included at the moment since it’s comparatively less useful. It’s best used with Nikki’s batch submission page.

It’s not pretty, but it gets the job done.

For anyone else who might find it useful, it’s available here. It runs locally and so an API key shouldn’t be necessary unless you’re running a huge number of queries. By all means, modify it as you wish or find necessary.

Edit: I’ve updated it a couple of times, to fix one or two bugs, and also to add the ability to disable image display (if you want to). Of note is that search results are locale-dependent so even without “Market” selected, you won’t see certain albums show up in results if they aren’t available where you’re searching from. You can either specify a market where they are available (or you expect them to be) when performing a search to override this. (This is a “feature” of the API and so I can’t do anything about it). This doesn’t apply when viewing all releases for an artist, where all will show unless you have a market filter specified.

Also some valid queries (or one, anyway for me) do not return any results (the API responds with null). This can be overcome by looking up the artist or album with its Spotify ID (which you can get from any of the applications or the Web Player). Again, this doesn’t appear to be a problem with my code, but some anomaly in the Spotify API.

9/5/2016 update:
So the page has been updated (link unchanged). Changes are:

  • Addition of direct submission to Musicbrainz


Very cool!

This is kind of a noob question, but I’ve never added ISRC’s, because I haven’t been too sure what they’re good for, how to get them, and it seems like another thing to do that would take away from other editing time.
This looks pretty straightforward.
So… is it important to add ISRC’s? Cheers :slight_smile:


Depends. They can be useful for establishing if two instances of a track on different releases are the same or not. http://wiki.musicbrainz.org/ISRC explains it sort of well.


I’m frequently merging recordings using ISRC’s which I’ve found from various sources. Lately I’ve founded lot of useful data from http://isrcsearch.ifpi.org (database of 20 million ISRC codes). Many classical compilations might not mention performers but this database is often including them.


This could be amazing as a userscript… Ping @jesus2099 or other userscript authors. :stuck_out_tongue_winking_eye:


It certainly would but I don’t remember having ever been able to browse a Spotify page. It would always tell me it works with a software, wouldn’t it?
Or do you have an example page?


If interested to learn more about it there’s Spotify Web API documentation at https://developer.spotify.com/web-api/endpoint-reference/. Code shared by @tatsumo already makes good usage of this API and seems to be useful for my needs. Currently I’ve been just copy-pasting id’s from Spotify-software to web browser and have inserted ids on API URL to get my precious ISRCs. To see what kind of data it returns see for example track or album.


If you “view source” on the hmvdigital website you can also see ISRCs (on the release page).


This could be an easy and quick user script.
If no one makes it but it is wanted, you can create a ticket at konami command.


Viewing source in that manner isn’t particularly more convenient than directly accessing the Spotify API JSONs, though.

The page as update can now submit directly to the server. After loading an album page from Spotify, you can load a Musicbrainz release by its MBID.
It will then check the track counts match (if they don’t it simply does nothing)*. If they match, it then adds a final column with the retrieved track names (so you can check they are what they should be).

*It currently matches track counts in a very primitive way: it assumes there that the first medium in the release is the entirety of the Spotify release (which works for most releases, as long as additional media are DVDs etc.)

The other caveat is that the requests to the MB server are subject to rate limitting. If a request fails (as it often does), you can just try again in a few seconds/minutes. At the moment the page doesn’t provide information as to why it hasn’t matched a MB release (whether it was a problem with the ID, the server, or the track count didn’t match).


2 posts were split to a new topic: Adding Spotify UIDs to MusicBrainz database


I don’t remember who I send that to (probably you) but, just in case and for the record, here is the User CSS to display ISRC in hmvdigital pages.


Thanks, this looks interesting.


@tatsumo - the search doesn’t seem to be working anymore. Any idea why this is?


Hmm, not sure. I’m on holidays with no computer at the moment so I can’t check until I get home. It was working last I tried it though.


I think I read something about how the API now requires a key for everything.


What @reosarevok said. See


I’m not sure how to get it working with the raw URL, but there is a page up (linked from the one @Freso gave) where I was able to get a response. It seems like the keys are specific to Spotify accounts, but that there’s no restriction on obtaining them – I just have a free account – and everything goes smoothly once you do.


I didn’t realise anyone actually used this but myself, but since there’s so much interest in it (apparently), I’ll add API key support when I get back.


I’m using it as well, although I modified it a bit to display release date and barcode as well. :slight_smile: