Announcements

Help Wizard

Step 1

NEXT STEP

Give us an endpoint to decode new shortened share links

Solved!

Give us an endpoint to decode new shortened share links

On mobile share-links are now shortened.

For example: https://spotify.link/hRkBrwub9xb

As a developer who relied on the URL containing the trackID this makes it impossible for me to find which track is being passed on. The website redirects to the correct song but it's not using 301 or 302 redirects which means that it probably is a client side JS redirect. 

Giving us an endpoint to paste the short url and retrieve the long url would be nice.

 

Redirect Chain

To further clearify that the short links are not a good idea is that embeds in popular chat programs like Discord won't work anymore. Even Spotify's own oEmbed endpoint does not work with this kind of URL: https://open.spotify.com/oembed?url=https://spotify.link/hRkBrwub9xb

 

 

"error": {
    "code": 404,
    "message": "Invalid URI: error in parsing"
}

 

 

Reply

Accepted Solutions
Marked as solution

I just ran into this issue myself, you don't actually need a dedicated endpoint for it because it's just a redirect. Just send a HEAD request to the URL and follow the redirects. Here's how you can unfurl it in Python.

import requests
r = requests.head("<spotify.link url>", allow_redirects=True)
print(r.url)

  And similarly in cURL.

curl -vILsw %{url_effective} https://spotify.link/hRkBrwub9xb

View solution in original post

2 Replies
Marked as solution

I just ran into this issue myself, you don't actually need a dedicated endpoint for it because it's just a redirect. Just send a HEAD request to the URL and follow the redirects. Here's how you can unfurl it in Python.

import requests
r = requests.head("<spotify.link url>", allow_redirects=True)
print(r.url)

  And similarly in cURL.

curl -vILsw %{url_effective} https://spotify.link/hRkBrwub9xb

Even though it gives the response code for forbidden it returns the full URL. This is, albeit not ideal, the solution.

 

Thanks!

Suggested posts