1
votes
https://api.spotify.com/v1/audio-analysis/{{track}}

Above is the GET request for the audio analysis of a song from Spotify. How do I change the request so that it only returns, for example, the key of the song or the song's tempo? I have tried all the usual ways and have been trialling and erroring various ways e.g https://api.spotify.com/v1/audio-analysis/{{track}}[0].analyzer_version . But none seem to work - any ideas?

{
    "meta": {
        "analyzer_version": "4.0.0",
        "platform": "Linux",
        "detailed_status": "OK",
        "status_code": 0,
        "timestamp": 1564300048,
        "analysis_time": 5.51708,
        "input_process": "libvorbisfile L+R 44100->22050"
    },
    "track": {
        "num_samples": 4813662,
        "duration": 218.30667,
        "sample_md5": "",
        "offset_seconds": 0,
        "window_seconds": 0,
        "analysis_sample_rate": 22050,
        "analysis_channels": 1,
        "end_of_fade_in": 0.00000,
        "start_of_fade_out": 192.80109,
        "loudness": -13.957,
        "tempo": 91.452,
        "tempo_confidence": 0.787,
        "time_signature": 4,
        "time_signature_confidence": 1.000,
        "key": 2,
        "key_confidence": 0.264,
        "mode": 0,
        "mode_confidence": 0.427,
        "codestring": "eJxNm4mVLDcOBF1pE3gf_jumiGS3_ujt6g3ZVUUSRyIBUOO2dXar91M-

Result of example request below:

Result of example request

1

1 Answers

0
votes
spotifyApi.getAudioAnalysisForTrack('4AKUOaCRcoKTFnVI9LtsrN').then(
                function(data) {
                    var analysis = console.log('Analyser Version', data.body.meta.analyzer_version);
                },
                function(err) {
                    console.error(err);
                }
            );

Here's how to do it in the code^^. I couldn't get it working in Postman strangely...