Fetching ISRCs from Spotify

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

Works great. This is a big help. Thanks for the work.

There is a limit, but not by me. Spotify’s API lookup accepts up to 50 entities at a time.

What’s happening here is that all of the tracks are being requested, and Spotify is only returning the first 50. This is just an oversight on my part, that the logic doesn’t batch them.

That will probably be fixed by the end of today. Done.

Basic artist view is now also available – like the tracklist issue, this does not batch the requests so will clip at the 50th release for now

5 Likes

perfect.
thanks again for the hard work.

A very small update today.

The current endpoints are now:

/artist/<Spotify artist ID URI> – returns the first 20 releases of the artist in Spotify’s catalogue* along with market availability as an ISO 3166-1 alpha-2

/album/<Spotify album ID> – returns the album info with ISRC, copyright info (market availability will be added to this later today)

/uri/<Spotify URI> – a limited auto parser, which will be built on in future. If you copy a Spotify URI (only available on desktop apps as far as I know) which appears in the format of spotify:artist:ID (or same for an album), it will save you the small but annoying step of manually pulling out the ID and attempt to parse the type, and ID, and send you to the correct view. e.g. tatsumo.pythonanywhere.com/uri/spotify:artist:1z4g3DjTBBZKhvAroFlhOM

2 Likes

Great job. This helps me a lot.

I made a tool (desktop application in .NET) to help me few years ago to retrieve ISRC’s from Spotify.
Unfortunately, since they changed the Web API to use OAuth, of course my tool didn’t work anymore and I’ve never found the time to change the code in order to use authentication (token, and so on)… and I must admit that I’m fed up with implementing (again and again) such big changes (authentication) just to retrieve the list of ISRC’s for an album (they already changed their API years ago in order to use JSON objects instead of XML…). If only I had enough time to to do this :cry: (as I always add ISRC’s into meta tags for my FLAC files).

So I am very happy to find your Web application :slight_smile: As it’s sometimes difficult to find them for few albums…From now on, I can use again ISRC’s from Spotify. Thank you again for your hard work! I really appreciate this.

1 Like

I’ve just updated it again. Now you can push the ISRCs to MB directly from an album view. You can paste either the release ID in MB, or its URL.

Note: if there’s a typo in the URL, it will crash the cause an error in the request. Also parsing the ID from a complete MB URL is not very robust definitely don’t be surprised if it doesn’t always work.

When you attach a MB release, it will do a shallow comparison of the track names, and the track lengths, to warn you if they are potentially not the correct targets. It doesn’t check existing ISRCs though. For the shallow comparison, it will ignore case and compare the strings, with certain characters stripped out (punctuation mainly). It’s very very flakey, but that’s why you can see the track names side by side as well to use common sense.

4 Likes

This is so awesome!!!

Great job!!! Thank you so much!

We really need edit notes on Add ISRCs edits!

2 Likes

I’m still going back and just copying the new URL. Hope that’s good enough. But yes, I have to go back and do that.

1 Like

That’s very good :+1: but I see many other ISRC edits without notes (even from some editors I keep telling them).
And when we don’t know for what release it was added and from what source, it’s then difficult to trust them and to later fix or merge with no mistakes.

4 Likes