Fetching ISRCs from Spotify

Tags: #<Tag:0x00007f73ade61a40> #<Tag:0x00007f73ade61770> #<Tag:0x00007f73ade61658> #<Tag:0x00007f73ade614c8>

Actually I think there was an issue in the refresh of Spotify credentials. I believe it was a race condition which I’ve now identified. I could reproduce it only on my phone (usually, but not 100%, which is why I think it was a race condition) so I assume it was about the order of execution in concurrent tabs.

I’m pretty sure it’s fixed now as I can’t reproduce it anymore.

5 Likes

Yep, Spotify stays logged in now, thanks!

There’s also currently an issue authenticating with MusicBrainz. I’m very certain the issue is on the MusicBrainz side as I rolled back several revisions (to versions where I’m 100% certain the was no problem) and it still receives a 400 from MusicBrainz.

Hopefully it will resolve itself shortly because there’s nothing I can do on my end that I can see.

It appears the issue is the MusicBrainz PKCE OAuth flow is broken (I assume – as I said, I haven’t changed anything on my side). So I’ve temporarily disabled it

4 Likes

Could you re-add the links back to the Spotify releases. When I add a release, I use your tool to see all the releases have around the world. Which is awesome, but currently I have to copy and paste the release ID, when I use to just make a click. I like the new layout.

2 Likes

@tatsumo, I encountered an issue when enabling PKCE on MB OAuth recently and it worked fine once resolved. I don’t think it is related to what you’re experiencing given your site was previously working but here’s the issue I had just in case it’s helpful.

The PKCE RFC states that when the code challenge method is “S256” the server verifies the “code_verifier” token as follows:

BASE64URL-ENCODE(SHA256(ASCII(code_verifier))) == code_challenge

The following line from the MB server code that performs the verification:

$code_challenge eq encode_base64url(sha256(decode_base64url($code_verifier))))

Note the call to decode_base64url here. The library I was using for OAuth was not base64 encoding the verifier before hashing it with SHA256 (it was already a valid ASCII string), which meant the PKCE validation failed. Once I base64 encoded the verifier before hashing it worked. I’m not 100% but based on my interpretation of the RFC I think the MB code isn’t compliant :man_shrugging:

That does indeed look like it wouldn’t work.

The thing is the library I’m using (pkce-challenge) did work on MB before, and I believe it worked consistently – it just stopped suddenly. But looking at that line on the server, I can’t see how it ever worked, nevermind working consistently.

FYI I’ve created a ticket for the PKCE issue.

Edit This should be fixed in the next MB server release :+1:

1 Like

Thank you @tatsumo for providing automatic edit notes now that this feature is finally available on MBS :hugs:
I would like to suggest a simple improvement: Can you replace the plain text MBID and the Spotify album ID by URLs so that you can comfortably navigate to them? At least for the MBID this would be really useful as I often check the release when I tracked down an old edit that has added a suspicious ISRC.

2 Likes

Yeah the edit note is very much a proof-of-concept. It was implemented when I was testing to see if it even worked (since the documentation was lacking). But since there’s no “test” version of MB, I had to write real data, so had to make it legit-ish, but didn’t spend much time on the template.

I’ll make a better template this weekend

7 Likes

Love the new notes. Does what I always did, so this is big time saver if you do a lot of these imports as I do.

2 Likes

@tatsumo: I really like your work and use it really often to import ISRCs into MB.
I wanted to use today but tatsumo.pythonanywhere.com seems to be unavailable… temporarily?

For the last few months it’s been redirecting to its new home at d.ontun.es

If you were using it, I’m surprised you would’ve never noticed it was doing that.

1 Like

@tatsumo: I’ve aways used the old URL until few days ago. I didn’t notice any redirection as the URL wasn’t changed in the address bar. Anyway, thank you so much for your great work and you quick reply!

New Markets

Angola, Antigua and Barbuda, Armenia, Azerbaijan, Bahamas, Bangladesh, Barbados, Belize, Benin, Bhutan, Botswana, Brunei Darussalam, Burkina Faso, Burundi, Cabo Verde, Cambodia, Cameroon, Chad, Comoros, Côte d’Ivoire, Curaçao, Djibouti, Dominica, Equatorial Guinea, Eswatini, Fiji, Gabon, Gambia, Georgia, Ghana, Grenada, Guinea, Guinea-Bissau, Guyana, Haiti, Jamaica, Kenya, Kiribati, Kyrgyzstan, Lao People’s Democratic Republic, Lesotho, Liberia, Macau, Madagascar, Malawi, Maldives, Mali, Marshall Islands, Mauritania, Mauritius, Micronesia, Mongolia, Mozambique, Namibia, Nauru, Nepal, Niger, Nigeria, Pakistan, Palau, Papua New Guinea, Rwanda, Samoa, San Marino, Sao Tome and Principe, Senegal, Seychelles, Sierra Leone, Solomon Islands, Sri Lanka, St. Kitts and Nevis, St. Lucia, St. Vincent and the Grenadines, Suriname, Tanzania, Timor-Leste, Togo, Tonga, Trinidad and Tobago, Tuvalu, Uganda, Uzbekistan, Vanuatu, Zambia, and Zimbabwe.

3 Likes

List is now updated.

This is only used for computing missing markets in releases that are available in most markets. These markets would’ve worked without the updated list, although the “missing markets” data would’ve been wrong.

They don’t appear to be live yet, so all releases will be missing at least these 80, until Spotify actually rolls out the release.

4 Likes

Thanks for the quick update. I have taken the liberty to extract your country list to update the list of a-tisket without having to convert the names to country codes myself, I hope you don’t mind :slight_smile:
While double-checking the changes I noticed that you have missed to add South Korea (KR) which was launched on 1st February, in total the list should then contain 92+1+85=178 territories.

1 Like

Oh I didn’t notice that. Yeah unfortunately there’s not a canonical list (in ISO form) from Spotify (if there is, I don’t know where to find it).

The base list was from some release that was globally licensed, and I just did a semi-automated conversion of the press release list to ISO codes.

Just updated again. I think this is the entire market list now

["AD", "AE", "AG", "AL", "AM", "AO", "AR", "AT", "AU", "AZ", "BA", "BB", "BD",
"BE", "BF", "BG", "BH", "BI", "BJ", "BN", "BO", "BR", "BS", "BT", "BW", "BY", "BZ", "CA", "CH", "CI", "CL",
"CM", "CO", "CR", "CV", "CW", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "ES", "FI",
"FJ", "FM", "FR", "GA", "GB", "GD", "GE", "GH", "GM", "GN", "GQ", "GR", "GT", "GW", "GY", "HK", "HN", "HR",
"HT", "HU", "ID", "IE", "IL", "IN", "IS", "IT", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KR",
"KW", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "MA", "MC", "MD", "ME", "MG", "MH", "MK",
"ML", "MN", "MR", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "MO", "NA", "NE", "NG", "NI", "NL", "NO", "NP",
"NR", "NZ", "OM", "PA", "PE", "PG", "PH", "PK", "PL", "PS", "PT", "PW", "PY", "QA", "RO", "RS", "RU", "RW",
"SA", "SB", "SC", "SE", "SG", "SI", "SK", "SL", "SM", "SN", "SR", "ST", "SV", "SZ", "TD", "TG", "TH", "TL",
"TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "US", "UY", "UZ", "VC", "VN", "VU", "WS", "XK", "ZA",
"ZM", "ZW"]
4 Likes

Hi,

The message is for @tatsumo or anyone who encountered that problem before.

I’m trying to use the site [https://d.ontun.es/] and it seems stuck after I log in from Spotify… I’ve been using it for a couple weeks and it worked like a charm until today!

I’ve tried several browser and it’s always the same dead end. The page is just plain black, tried to flush my cache, refresh/force refresh and nothing worked so far. Is there something wrong with the page or something I did wrong? Links from the atisket “complimentary links” page doesn’t work either…

Thanks for the great script!

Can reproduce.

TypeError: can't access property "split", t.scope is undefined

Oh I think Spotify possibly stopped returning scopes when they’re empty.

The utility function I wrote for interacting with the API parses them (although they’ll always be empty) and since that hasn’t changed, I can only assume Spotify’s API has.

Fixed.

4 Likes