Skip to content

Instantly share code, notes, and snippets.

@TheDuchy
Created October 21, 2022 14:28
Show Gist options
  • Save TheDuchy/7e00c8b1b4c778d86b4ab20ea5889ce3 to your computer and use it in GitHub Desktop.
Save TheDuchy/7e00c8b1b4c778d86b4ab20ea5889ce3 to your computer and use it in GitHub Desktop.
Spotify turned into Spoopyfy, so I have decided to migrate and aint no way I'm paying for something that should be free
# Get client ID and secret at https://developer.spotify.com/dashboard/
# Input file is Ctrl+A and Ctrl+C on playlist you want to export
# example input "https://open.spotify.com/track/0xo5YJ2SJSK55uV2NV8hUn"
# example output "["crypvolk","Can You Feel My Heart (Hardstyle)"]"
CLIENT_ID=""
CLIENT_SECRET=""
INPUT_FILE="spoopyfy.txt"
OUTPUT_FILE="tracklist.txt"
ACCESS_TOKEN=`curl -X POST https://accounts.spotify.com/api/token -H "Authorization: Basic $(echo -n "$CLIENT_ID:$CLIENT_SECRET" | base64 -w0)" -d "grant_type=client_credentials" | jq -r .access_token`
for x in $(cat "$INPUT_FILE" | rev | cut -d '/' -f1 | rev); do curl -X GET https://api.spotify.com/v1/tracks/$x -H "Authorization: Bearer $ACCESS_TOKEN" -H 'Content-Type: application/json' | jq -r -c "[.artists[].name,.name]" >> "$OUTPUT_FILE"; sleep 1;done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment