Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spotify API, same music with differents IDs in App get the same IDs from API

Tags:

spotify

Title says almost everything.

I found that the music "Boom - 2006 Remastered Version" has two different IDs that can be found in the App:

  • 3EKjTDAEIdyQqsA9qtb5P2
  • 0zlAqnRv07p9ezzFf3k2ky

But when using the API to get information about each one, it returns the same ID:

  • 3EKjTDAEIdyQqsA9qtb5P2

Is this a bug?

like image 207
ColdFox Avatar asked Sep 06 '25 03:09

ColdFox


1 Answers

It is unfortunately not a bug, but it is indeed very annoying, and your code needs to be able to handle it.

"Give me info for track A! Ok, here is info for track B, just like you asked".

It is a legacy thing still left in the Spotify metadata model called track redirects (the some concept exist on albums and artist too, but are less of a problem there). It was made so that we could quickly merge duplicate albums. It means that once upon time, there were two "different" tracks on different albums that were identical. We had lots of them on artists pages for popular artists. Labels would very often upload one album for one country and another identical one for another country instead of just saying that one album was available in two countries. Sometimes by mistake, most often because of cross licensing issues between labels and countries.

Track redirects are quite rare though if you look at the entire catalog. Most of these redirect tracks are only surfaced in old playlists and are for instance never returned in search results or artist pages. These days we never merge duplicates like this, but instead make sure only one is shown on artist pages, etc. and link to the other in case one is unavailable in your country. That is the concept called Track relinking in the docs. https://developer.spotify.com/web-api/track-relinking-guide/

I work at Spotify and bump into this problem every now and then. I want to change this so the tracks and album become just regular duplicates, because it is much easier to reason about, but it will take a while to fix. I guess I can update my answer here in a few years when it is done.

like image 50
jooon Avatar answered Sep 09 '25 11:09

jooon