Spotify API: Get A User's Top Tracks
Notes
The page assumes you have
There's a "next" featured defined for getting more items, but I'm only seeing 50 so I'm setting the limit to that and not messing with it.
This is set to "long_term" - calculated from several years of data and including all new data as it becomes available
There's also: medium_term which is roughly the last 6 months, and short_term which is roughly the past 4 weeks
The default is: medium_term
JavaScript
const user_id = localStorage.
const access_token = localStorage.
const
const url =
const params =
: `long_term`,
: 50
}
url. = .
const payload =
: 'GET',
:
: `Bearer `
},
}
const body = await
const response = await body.
return response
}
const
let output = "";
const data = await
data..
spotifyData. = output
}
document.