Type in your question below and we'll check to see what answers we can find...
Loading article...
Submitting...
If you couldn't find any answers in the previous step then we need to post your question in the community and wait for someone to respond. You'll be notified when that happens.
Simply add some detail to your question and refine the title if needed, choose the relevant category, then post.
Before we can post your question we need you to quickly make an account (or sign in if you already have one).
Don't worry - it's quick and painless! Just click below, and once you're logged in we'll bring you right back here and post your question. We'll remember what you've already typed in so you won't have to do it again.
Please see below the most popular frequently asked questions.
Loading article...
Loading faqs...
Please see below the current ongoing issues which are under investigation.
Loading issue...
Loading ongoing issues...
The Track Web API provides a lot of useful information and more can even be retrieved from the Get Audio Analysis endpoint. A track additionally has a lot of metadata flags such as the explicit flag but there is no language attribute on the track object. Would it be possible to expose a track's language so that apps/extensions can be used to leverage this?
Use cases such as:
- Prevent the playing of any songs not in a preferred language
- Creating Playlists based on language
- Getting better recommendations based on language
If language isn't something that doesn't yet exist in the track API then this is very easy to backfill using NLP models. Google Translate has an autodetect language feature which showcases this. An implementation for fixing bad language labels could also be available for users and could be regulated based on amount of reports for the same language for example.
It would be a really nice feature and l know I would personally benefit from this because if there is one thing that grinds my gears, it is getting songs with languages I don't even speak in my Discover Weekly! 🙂
Hey! I was searching for the same question on the internet and landed here.
Were you able to figure it out? I couldn't find any answer to it.
Turns out the Spotify client makes requests to an internal API does indeed return info about the track's language. However, this API is not accessible through the official API token.
Example:
GET https://spclient.wg.spotify.com/metadata/4/track/80b933ec871d4e39955980ca131fde18?market=from_token
Authorization: Bearer <token from Spotify client>
Response:
While the "language_of_performace" is not available for all tracks, the information is already there, so it would be great if the Spotify Developers could add this to the official API.
what is it and how can i access it
That's the track id and you usually get them from other API endpoints.
So I found a way to make this work.
You can make requests to https://spclient.wg.spotify.com/ if you retrieve the access token from https://open.spotify.com/get_access_token/. That's where the web player gets it's token from.
Some endpoints of the https://spclient.wg.spotify.com/ require a non-anonymous user, which you can get by accessing https://open.spotify.com/get_access_token/ with a logged-on Spotify account in your browser, or by passing the proper cookie from open.spotify.com in the request.
Other endpoints (which include the one I mentioned to retrieve track details) can be accessed with an anonymous access token.
Example:
GET https://spclient.wg.spotify.com/metadata/4/track/80b933ec871d4e39955980ca131fde18?market=from_token
Authorization: Bearer <accessToken from https://open.spotify.com/get_access_token/>
App-Platform: WebPlayer
Accept: application/json
Do note the "App-Platform: WebPlayer" header may be required for some of the endpoints, it doesn't look like it's required for this particular one.
The endpoint https://open.spotify.com/get_access_token/ has CORS restrictions, so if you want to use the anonymous access token in a web app, you will need to use a server-side proxy. If you need the non-anonymous access token unfornately there is no automated way to do this, you will have to ask the user to either input the access token itself or at least the cookie.
How do you get this track ID? It's not the 'track ID' from the Spotify API, it's called 'gid' on the screenshot you posted earlier
How are you getting the track ID? I am copying it from the track's share URL link, and I am getting 404 when I replace.
https://open.spotify.com/track/7BKLCZ1jbUBVqRi2FVlTVw
Track ID = 7BKLCZ1jbUBVqRi2FVlTVw
The ID mentioned in the above examples(80b933ec871d4e39955980ca131fde18) has a different length and this ID does not work in api.spotify to fetch track details (throws error).
I am able to retrieve track details from api.spotify though (Web API Reference | Spotify for Developers) with the above-mentioned ID.
Edit: Found this solution Spotify - "gid" of Tracks.
Hey, you are all right, this is an internal id commonly referred as gid. There is a way to translate gid to an id understood by the public API and back, if you look around in the web you'll find answers on how to do this conversion. Last time I tried to post the algorithm my comment was deleted without explanation, so I don't think I can disclose this here.
Edit: sorry didn't see your edit, that's it!
Hey there, I'm trying to convert a track id to GID but it doesn't seem to be working. Do you know how to convert a track id to GID. I tried reversing the code in the stackoverflow thread but it doesn't seem to be doing it..
edit: NVM GOT IT
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game and get…