获取 Spotify 播放列表(歌单)及歌曲库列表

#!/usr/bin/env bash
echo "" > $1
start=0
step=50
for i in {1..10}
do
    curl "https://api.spotify.com/v1/me/tracks?offset=${start}&limit=${step}&market=from_token" -H 'authorization: Bearer ${token}' -H 'origin: https://open.spotify.com' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: zh-CN,zh-MO;q=0.9,zh-SG;q=0.8,zh;q=0.7' -H 'user-agent: '${UA}' -H 'accept: application/json' -H 'referer: https://open.spotify.com/collection/tracks' -H 'authority: api.spotify.com' -H 'dnt: 1' --compressed >> $1
    start=`expr $start + $step`
done
echo "Congraturation!"
cat tem|grep '^      \"name\|^        "name'|sed 's/^      "name" : /Name:/'|sed 's/,$//'|sed 's/"//g'|less
tag(s): none
show comments · back · home
Edit with markdown