Help Wizard

Step 1

NEXT STEP

Get lyrics

Get lyrics

Operating System

Windows 11

My Question or Issue

I'm trying to get the lyrics to the song by querying https://spclient.wg.spotify.com/color-lyrics/
But I can't, I get the answer that the wrong token, or the client. Can you give me a hint, or give me a code example, I would appreciate it.

Reply
6 Replies

Where did you get that URL from? I can't find anything about lyrics in the official Spotify for Developers docs.

This request is sent when you click the 'show text' button on the official Spotify website. If you look at the body of the response, it contains texts and timestamps

According to this news article, the lyrics comes from Musixmatch. Musixmatch has it's own API and documentation.

 

 

Pretty easy. First of all, you need a token. I'm not sure if the token from the official API is working, but the one from https://open.spotify.com/get_access_token  should be working fine. Now we need a track id and an image for the background (image is optional). The image has to be an url from spotifys servers. As the headers we need the token and the app-platform: WebPlayer. Second one is very important, there's no warning that you would need that.

Now let's put everything together:

 

 

URL: 

https://spclient.wg.spotify.com/color-lyrics/v2/track/0VjIjW4GlUZAMYd2vXMi3b/image/https%3A%2F%2Fi.scdn.co%2Fimage%2Fab67616d0000b2738863bc11d2aa12b54f5aeb36?format=json&vocalRemoval=false&market=from_token 

The image has to be URL-encoded. The params are optional, but you should probably keep the format.

 

URL without the image:

https://spclient.wg.spotify.com/color-lyrics/v2/track/0VjIjW4GlUZAMYd2vXMi3b?format=json&vocalRemoval=false&market=from_token 

 

Here again as a curl command:

curl -i "https://spclient.wg.spotify.com/color-lyrics/v2/track/0VjIjW4GlUZAMYd2vXMi3b/image/https%3A%2F%2Fi.scdn.co%2Fimage%2Fab67616d0000b2738863bc11d2aa12b54f5aeb36?format=json&vocalRemoval=false&market=from_token " -H "authorization: Bearer your_bearer_token" -H "app-platform: WebPlayer"

The bearer token I get by opening that URL in ny browser works. But if I try to get a token by making a curl request with the same URL, the token I get is much shorter and that token doesn't work. 

Oh, that might have been my mistake. Anonymous access apparently doesn't work. When opening the URL in the browser, then it's actually a user token, if you're already logged in. For now, I cannot find another way to retrieve lyrics.

Suggested posts