https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-features/
Hi, i'm using the spotify web api to get audio features of a track. In the website mentioned above, there's an explaination of how it works. The problem is that it can only get the audio features from one specific track, depending on the id. But i want the id to change when I play a different track, so that i get the audio features of the currently playing track. Does somebody know how to do this? In the code below you can see the url. At the end of the link you see: 06AKEBrKUckW0KREUWRnvT That is the id of the track.
This is my code:
$.ajax({
url: 'https://api.spotify.com/v1/audio-features/06AKEBrKUckW0KREUWRnvT',
headers: {
'Authorization': 'Bearer ' + access_token
},
success: function(response) {
audioFeaturesPlaceholder.innerHTML = audioFeaturesTemplate(response);
console.log(response);
$('#login').hide();
$('#loggedin').show();
}
});