Fetching ISRCs from Spotify

I’m glad the JavaScript was readable enough to do that :joy:

1 Like

Thanks guys! Rotab any chance you could send me your version? :slight_smile:

If you want to show release date and barcode, open script.js and paste

Text += data.release_date + " (Precision = " + data.release_date_precision + ")"; Text += "</td></tr><tr><td>"; //loop over all external ids Object.keys(data.external_ids).forEach(function(key) { Text += key + ": " + data.external_ids[key] + " "; }) Text += "</td></tr><tr><td>";

before (currently line 128)

and change Text += "<table class=\"summary\"><tr><td rowspan=\"5\">" + CreateImage(data.images[0].url, "cover") + "</td><td>" + data.name + "</td></tr>";
to Text += "<table class=\"summary\"><tr><td rowspan=\"7\">" + CreateImage(data.images[0].url, "cover") + "</td><td>" + data.name + "</td></tr>";

1 Like

Thanks @Rotab!

@tatsumo if you could add API key support once you’re back from holiday that’d be amazing. Would be a lifesaver!

2 Likes

Hi @Rotab - do you think it’d be possible for you to try and fix this? Thanks in advance!

1 Like

I miss being able to add ISRC from Spotify :confused:

1 Like

I’ll take a look since it seems @tatsumo has disappeared
Unfortunately I don’t think you can’t generate the api token directly from the page, and the token only lasts for 30 minutes.

2 Likes

Since this is one of the most powerful ways that we can get ISRCs and barcodes for digital releases, streamlining the process seems important. It would be brilliant to have a userscript that fetches and adds ISRCs for all tracks in a release based on Spotify ID. Might those differ based on region, as they do in CD releases?

1 Like

It’s not often that ISRC depend on region.
Usually recordings get the same ISRC worldwide when the various regional editions are around the same time.

I’m a little confused by this - Surely “Country Code” is part of the ISRC structure?

1 Like

I meant usually, the same recordings keep the same ISRC in all editions of same album worldwide. :slight_smile:

2 Likes

Ah, then I misunderstood. My bad!

1 Like

Hey guys, so after a long hiatus (I know) I am building a new version of this. I don’t have an ETA, but not very long – a couple of weeks at most, before I have an initial version. But depending on how bored I am, it could be as little as a couple of days.

This one will be built in Python, and will be CLI-only initially – but I do plan to extend it to be a Flask app (or something like that) so that it is easier to navigate visually.

The new version is going to be powered by Deezer, so the big caveat is that Deezer’s catalogue is not quite as big as Spotify’s. The reason it’s going to use Deezer is because Deezer still provide a nice open API that doesn’t require authentication and API keys.

5 Likes

Awesome! Do you know of anyway to batch search for multiple songs? For a personal art project I need to look up the ISRC for 500+ soungs. Searching individually will be a time suck. Thanks so much!

Batch search will be a bit tricky but batch lookup I can definitely add. Bit behind schedule since my laptop went and died on me soon after I started.

I’ll add proper handling of rate limiting so that it can do large lookups and just wait when its been throttled — right now it’ll just crash if it gets throttled.

I’ll see what I can do about search, but the main issue would be how it works — if it’s just going to use the first result as a best match, that’s probably too naïve to be useful. And manually selecting the result each time might not prove much more useful than searching on the website.

Search is one of the next things I’m adding but right now only lookup works: an album or track ID (or the whole URL and it’ll try to parse the ID from it) and it’ll spit out the ISRC(s) and basic metadata.

So. An update, and a proof of concept.

This morning I abandoned the Deezer project. Why? The very albums I was trying to get ISRCs for, were often in the list of titles Spotify has, but Deezer doesn’t.

So instead, I present an extremely alpha version of a Spotify-powered tool: http://tatsumo.pythonanywhere.com/album/<insert spotify album ID>, example http://tatsumo.pythonanywhere.com/album/5yuWF28EuLGYQ3dtGLjUAC

Right now it will literally only give you the track names and ISRCs. It doesn’t have proper error handling, and it’s probably not going to be hard to crash it, but for anyone who wants to alpha test it, feel free. If something goes wrong, do not bug me about it. In all likelihood I already know about the issue – as I said, it currently has no error handling whatsoever. It will just fail for an unknown album ID, if the bearer token expires (it does renew them, but it doesn’t handle the error if they expire), if the request is throttled, if there’s a parsing error etc… All of this is being worked on.

It only supports structured HTML output and it’s extremely unlikely this will change (except maybe specifically to get only a list of ISRCs) – the reason for this is that I don’t want it being used as a replacement for using the Spotify API directly.

In the very near future (i.e. next couple of days, I hope), I’ll add some more metadata like UPCs (UPC is now done) etc, as well as cleaning up the very very bad HTML.

Since I don’t consider it a “release”, I may take it down without warning – most likely scenario being because I made a code change and broke something.

11 Likes

Excellent stuff, @tatsumo !
It’s compatible with the mass add ISRC bookmarklet ; Just select all, copy, bookmarklet, paste (take care of track alignment, tracks without ISRC).

2 Likes

Hopefully it’s useful anyway.

Things that are coming are (in roughly this priority but it kind of depends on my mood :sunglasses: ):

  • An artist view, to list all releases for a given artist (currently these just tell you to view the artist on Spotify, but there is actually some backed requests going on for artists – they just aren’t being shown).
  • An entry point that parses *.spotify.com links and URIs for you, so you don’t have to manually extract the IDs from them – this is irritating me personally, which is why it’s relatively high in the priority list.
  • Better display, with some more metadata – showing all artists of a track/release (right now it just shows the first) etc.
  • Direct submission to MB
  • Lookup of retrieved ISRCs in MusicBrainz

Things that are not coming:

  • A track view – I can’t see any reason anyone would need this. Just use the album/single the track is attached to. Would be nice to have, maybe, but that’s about it. I will probably add a fake track endpoint, which actually looks up the release that a given track is attached to.
  • Search – this requires a relatively non-trivial amount of extra work, and will add additional load both to the service, and in its calls to Spotify – both of which have capacity or rate limiting. I can’t see this actually becoming an issue (at least not now), but since Spotify’s own search is available, I don’t think this has any real need either. The artist view will hopefully obviate any need for one – since searching for releases on Spotify can be difficult if they’re only available in specific markets, artist view will (hopefully) dump all releases in all Spotify territories.
2 Likes

Even now it does the job beautifully.
I’m sure the additions will be even better.
Thanks.

I’ve been testing it so far and it’s working fine. Well done.
Only one issue I’ve come across; it’s returning only the first 50 tracks of the albums that have more.
e.g.

I was wandering if there is a some kind of limit set.

Thanks again.

1 Like