Announcements

Resolve link.tospotify.com to ID

Reply
Highlighted

Resolve link.tospotify.com to ID

Visitor

Is there a way to get more information from the characters after "link.tospotify.com" via the API?  Like the Spotify ID of a track.

 

For example https://link.tospotify.com/TsNdTNARuab

 

1 Reply
Highlighted

Re: Resolve link.tospotify.com to ID

Regular

I don't think that's directly searchable anywhere. If you follow the link and parse the HTML response the track Id can be found that way though.

 

In the <head> part of the page you're redirected to there's a tag that looks like this:

<meta property="og:url" content="https://open.spotify.com/track/0ttF21hZCPw2merE3GsHcP">

<meta property="og:url" content="https://open.spotify.com/track/0ttF21hZCPw2merE3GsHcP">

 

The last part being the track Id that can then be accessed using the API using this endpoint: 

https://api.spotify.com/v1/tracks/{id}

 

SUGGESTED POSTS