Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Own your list of favourite tracks on Spotify
# you need
# and
# to roll like this
# get your token at
while [ "$next" != "null" ]; do
buffer=$(curl -s -X GET "$uri" -H "Accept: application/json" -H "Authorization: Bearer $token")
echo "$buffer" | jq -c '.items[] | {album_id:, album_name:, artist: .track.artists[0].name, title:, uri: .track.uri}' | \
json2csv -k album_id,album_name,artist,title,uri
uri=$(echo "$buffer" | jq -c '.next' | tr -d '"')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment