Compare commits

...

7 Commits

5 changed files with 9382 additions and 1237 deletions

View File

@@ -1,25 +1,43 @@
#!/usr/bin/env bash
set -eu
BEARER_TOKEN_RES=$(
curl -sL https://open.spotify.com/ \
| grep 'id="session"' \
| sed 's&.*<script id="session"[^>]*>&&' \
| sed 's/<.*//'
)
BEARER_TOKEN=$(echo "$BEARER_TOKEN_RES" | jq -r .accessToken)
export BEARER_TOKEN
if [[ -z "${BEARER_TOKEN:-}" ]]; then
printf "Atempting to scrape a bearer token...\n"
GUEST_TOKEN_RES=$(
curl -sX POST https://clienttoken.spotify.com/v1/clienttoken \
-H "Accept: application/json" -H "content-type: application/json" \
--data '{"client_data":{"client_version":"1.2.27.147.g503c721c","client_id":"d8a5ed958d274c2e8ee717e6a4b0971d","js_sdk_data":{"device_brand":"unknown","device_model":"unknown","os":"linux","os_version":"unknown","device_id":"nuhuh","device_type":"computer"}}}'
)
BEARER_TOKEN_RES=$(
curl -sL https://open.spotify.com/ \
| grep 'id="session"' \
| sed 's&.*<script id="session"[^>]*>&&' \
| sed 's/<.*//'
)
BEARER_TOKEN=$(echo "$BEARER_TOKEN_RES" | jq -r .accessToken)
if ! [[ "$(echo "$GUEST_TOKEN_RES" | jq -r .response_type)" == "RESPONSE_GRANTED_TOKEN_RESPONSE" ]]; then
printf "\x1b[1;31m%s\x1b[0m\n" 'Token response is NOT granted' >&2
exit 1;
if [[ -z "${BEARER_TOKEN:-}" ]]; then
printf "ERR: Failed to get a bearer token, pass one with \$BEARER_TOKEN\n" >&2
exit 1
fi
export BEARER_TOKEN
fi
TOKEN=$(echo "$GUEST_TOKEN_RES" | jq -r .granted_token.token)
export TOKEN
if [[ -z "${TOKEN:-}" ]]; then
printf "Atempting to get a token with the bearer one...\n"
GUEST_TOKEN_RES=$(
curl -sX POST https://clienttoken.spotify.com/v1/clienttoken \
-H "Accept: application/json" -H "content-type: application/json" \
--data '{"client_data":{"client_version":"1.2","client_id":"d8a5ed958d274c2e8ee717e6a4b0971d","js_sdk_data":{"device_brand":"unknown","device_model":"unknown","os":"unknown","os_version":"unknown","device_id":"unknown","device_type":"unknown"}}}'
)
if ! [[ "$(echo "$GUEST_TOKEN_RES" | jq -r .response_type)" == "RESPONSE_GRANTED_TOKEN_RESPONSE" ]]; then
printf "\x1b[1;31m%s\x1b[0m\n" 'Token response is NOT granted' >&2
exit 1;
fi
TOKEN=$(echo "$GUEST_TOKEN_RES" | jq -r .granted_token.token)
if [[ -z "${BEARER_TOKEN:-}" ]]; then
printf "ERR: Failed to get a normal token, pass one with \$TOKEN\n" >&2
exit 1
fi
export TOKEN
fi

File diff suppressed because it is too large Load Diff

View File

@@ -83,7 +83,7 @@ Memories - Maroon 5
Paradise - Coldplay
Hey Brother - Avicii
Some Say - Nea
Rockabye (feat. Sean Paul & Anne-Marie) - Clean Bandit
Rockabye (feat. Sean Paul & Anne-Marie) - Clean Bandit, Anne-Marie
Don't Start Now - Dua Lipa
One Kiss (with Dua Lipa) - Calvin Harris, Dua Lipa
Wake Me Up - Avicii
@@ -1083,7 +1083,7 @@ Walking On A Dream - Empire Of The Sun
We Are The People - Empire Of The Sun
End of Beginning - Djo
a dónde voy??? - Wuicho kun, Azul de Viena
Sunroof - Nicky Youre, dazy
Sunroof - Nicky Youre, hey daisy
DUMB - BEGINNERS
よふかしのうた - Creepy Nuts
ロスタイム - Creepy Nuts
@@ -1172,3 +1172,95 @@ Shiny Happy People - R.E.M.
SNAP - Rosa Linn
Painkiller - Beach Bunny
Painkiller - Ruel
Run - OneRepublic
hourhand - suzie ver. - suzie
SPEED OF SPICE - suzie ver. - suzie
Look After You - The Fray
She Is - The Fray
Over My Head (Cable Car) - The Fray
Heartbeat - The Fray
Be Still - The Fray
Love Don't Die - The Fray
I Can Talk - Two Door Cinema Club
I Don't Wanna Wait - David Guetta, OneRepublic
I Ain't Worried - OneRepublic
A Thousand Miles - Vanessa Carlton
Sunshine - OneRepublic
I Lived - OneRepublic
Clint Eastwood - Gorillaz
Double Life - From "Despicable Me 4" - Pharrell Williams
Wake Up And Smell The Coffee - The Cranberries
GROWING UP IS _____ - Ruel
D.A.N.C.E - Justice
Somniphobia - Afourteen
Aawake At Night - half•alive
ecstacy - SUICIDAL-IDOL
Cigarette Ahegao - Penelope Scott
Homage - Mild High Club
Looking Out for You - Joy Again
Falling Down - Bonus Track - Lil Peep
Bass Slut - Original Mix - S3RL
She Looks So Perfect - 5 Seconds of Summer
Guillotine - Rory Webley
Miss Sunshine - Surfaces, Arden Jones
Lost Umbrella - 稲葉曇
Lost Umbrella - Inaba Cumori
INVISIBLE - Duran Duran
FORGET YOU - Dutch Melrose
Die Young - Kesha
Don't Matter - Derik Fein
Mr Doctor - Alex Robbins
Rock Bottom - Justin Versluis
Beautiful Lies - Sped Up - Alex Robbins
Im Doing Fine - Marino, Promoting Sounds
I Can't Fit In - Marino
My Ordinary Life - The Living Tombstone
Nosebleed - Frankie Linstrom
Isis (Remix) - Versvs
McDonald's in the Pentagon - Silly Stu
blue - sped up - yung kai
Omen - Disclosure
Accidentally In Love - Various Artists
blue - yung kai
Kiss Me Again - Nightcore Mix - Roy Bee
Toxicity - System Of A Down
Heaven - DJ Sammy, Yanou
Dragostea din tei - O-Zone
Stereo Love - Edward Maya, Vika Jigulina
Виртуальная любовь - Tanin Jazz
Rhythm Is a Dancer - SNAP!
Qué Bien - IZAL
Carolina - Various Artists
CHAINS ON ME - LaLion
PRETTY PLEASE - Dutch Melrose, benny mayne
Little Love - Corey Corner
4x4 - Versvs
Redbone - Various Artists
Eleven - Furnace Woods
Spinning A Web - Maz Univerze
Мой мармеладный (Я не права) - Katya Lel
Selfish - byjaye, Toby Hobart
bored - Day Tvvo
Breezeblocks - alt-J
Summer - Good Kid
Money - The Drums
Aloe Lite - Good Kid
On Melancholy Hill - Gorillaz
Someday - The Strokes
Lovers Rock - TV Girl
505 - Arctic Monkeys
Seventh Heaven - INOHA
Borderline - Tame Impala
A-Punk - Vampire Weekend
Kids - MGMT
Tongue Tied - GROUPLOVE
Chamber Of Reflection - Mac DeMarco
i walk this earth all by myself - EKKSTACY
One Day - Lovejoy
Heart To Heart - Mac DeMarco
WASTE - KXLLSWXTCH
Space Song - Beach House
Telephones - Vacations
Cigarettes out the Window - TV Girl
For the First Time - Mac DeMarco
Murder on the Dancefloor - triple j Like A Version - Royel Otis

View File

@@ -83,7 +83,7 @@
["6nek1Nin9q48AVZcWs9e9D","Paradise","Mylo Xyloto",["Coldplay"]]
["4RXpgGM7A4Hg7cFBoH5KyF","Hey Brother","True",["Avicii"]]
["4poybupy26pTWPr9zY1i7h","Some Say","Some Say",["Nea"]]
["5knuzwU65gJK7IF5yJsuaW","Rockabye (feat. Sean Paul & Anne-Marie)","Rockabye (feat. Sean Paul & Anne-Marie)",["Clean Bandit"]]
["5knuzwU65gJK7IF5yJsuaW","Rockabye (feat. Sean Paul & Anne-Marie)","Rockabye (feat. Sean Paul & Anne-Marie)",["Clean Bandit","Anne-Marie"]]
["6WrI0LAC5M1Rw2MnX2ZvEg","Don't Start Now","Don't Start Now",["Dua Lipa"]]
["7ef4DlsgrMEH11cDZd32M6","One Kiss (with Dua Lipa)","One Kiss (with Dua Lipa)",["Calvin Harris","Dua Lipa"]]
["4h8VwCb1MTGoLKueQ1WgbD","Wake Me Up","True",["Avicii"]]
@@ -1083,7 +1083,7 @@
["3zEN0ii6s4DHHBpnTp3RP7","We Are The People","Walking On A Dream (10th Anniversary Edition)",["Empire Of The Sun"]]
["3qhlB30KknSejmIvZZLjOD","End of Beginning","DECIDE",["Djo"]]
["6ieFir0Sk20XxcUxp3fIiS","a dónde voy???","a dónde voy???",["Wuicho kun","Azul de Viena"]]
["6WHSNH8PhDHbpYxg4I181o","Sunroof","Sunroof (Remixes)",["Nicky Youre","dazy"]]
["6WHSNH8PhDHbpYxg4I181o","Sunroof","Sunroof (Remixes)",["Nicky Youre","hey daisy"]]
["0O354383OL3XXPICUiHOkl","DUMB","DUMB",["BEGINNERS"]]
["0LQs5gRhqJKLOl8fFukRsQ","よふかしのうた","よふかしのうた",["Creepy Nuts"]]
["1O4JEMG1V06Lmkw8JQMY52","ロスタイム","アンサンブル・プレイ",["Creepy Nuts"]]
@@ -1172,3 +1172,95 @@
["5hx7w26Zi3zafMgvMTUqF6","SNAP","SNAP",["Rosa Linn"]]
["415aR5b8Uws9UPGTsssWaS","Painkiller","Prom Queen",["Beach Bunny"]]
["1YlulsUKDduOmC7WxvXYPW","Painkiller","Free Time",["Ruel"]]
["2UbVnbE5FH6008mAm6Mmgw","Run","Run",["OneRepublic"]]
["19fFqVeuXGZPdERv3HqCsa","hourhand - suzie ver.","hourhand",["suzie"]]
["01BeOYvjTtZbrbVxAmqavx","SPEED OF SPICE - suzie ver.","SPEED OF SPICE",["suzie"]]
["5l6hpyTGBK0LAAxgPnqTQL","Look After You","How To Save A Life",["The Fray"]]
["5Re8AyLirdL9F5VeLI8JzN","She Is","How To Save A Life",["The Fray"]]
["1N62wozuHCvczCkY4QidpP","Over My Head (Cable Car)","How To Save A Life",["The Fray"]]
["2atYprr9JsQaLynGhrWhld","Heartbeat","Scars & Stories",["The Fray"]]
["3URt4lJQlANOstDBAWQJA7","Be Still","Scars & Stories",["The Fray"]]
["6IDDwI0YOCAUDhMZltQekS","Love Don't Die","Helios",["The Fray"]]
["6W7rf0mCRfcvz5RpRdwLfm","I Can Talk","Tourist History",["Two Door Cinema Club"]]
["331l3xABO0HMr1Kkyh2LZq","I Don't Wanna Wait","I Don't Wanna Wait",["David Guetta","OneRepublic"]]
["0oF9jpn0n8afMpbHKgRd6J","I Ain't Worried","Artificial Paradise (Deluxe)",["OneRepublic"]]
["4w1lzcaoZ1IC2K5TwjalRP","A Thousand Miles","Be Not Nobody",["Vanessa Carlton"]]
["7qKIbKpRqsDoXG5vMK6fuT","Sunshine","Artificial Paradise (Deluxe)",["OneRepublic"]]
["3IQF4xCQUPicbA4hWfTxPo","I Lived","Native",["OneRepublic"]]
["1RKUoGiLEbcXN4GY4spQDx","Clint Eastwood","Gorillaz",["Gorillaz"]]
["07oO1U722crtVcavi6frX6","Double Life - From \"Despicable Me 4\"","Double Life (From \"Despicable Me 4\")",["Pharrell Williams"]]
["4wNsFOg7fVR5qCulLG071k","Wake Up And Smell The Coffee","Wake Up And Smell The Coffee",["The Cranberries"]]
["4KkjSqBzF06TS1fhasBQWH","GROWING UP IS _____","4TH WALL",["Ruel"]]
["33yAEqzKXexYM3WlOYtTfQ","D.A.N.C.E","Justice",["Justice"]]
["5SXM4OsHpWqgNUfvZRI2m6","Somniphobia","Somniphobia",["Afourteen"]]
["0zms6rKU9lh6BbIrp1gDcZ","Aawake At Night","3",["half•alive"]]
["2CIlKt4lRwAAUx5fYgCBxN","ecstacy","ecstacy",["SUICIDAL-IDOL"]]
["67VxWciiaYZYy3NTlyCtp7","Cigarette Ahegao","Public Void",["Penelope Scott"]]
["7DcJ6fEBb7BaKuYKTwiDxK","Homage","Skiptracing",["Mild High Club"]]
["3jfZ9M23l0L7RxzYMTgBTv","Looking Out for You","Looking Out for You",["Joy Again"]]
["4jvjzW7Hm0yK4LvvE0Paz9","Falling Down - Bonus Track","Come Over When You're Sober, Pt. 2",["Lil Peep"]]
["51czegKF9UbmUZkp8etKj2","Bass Slut - Original Mix","Bass Slut / It Went / Crazy Ass Bitch",["S3RL"]]
["1CQ2cMfrmFM1YdfmjENKVE","She Looks So Perfect","5 Seconds Of Summer",["5 Seconds of Summer"]]
["1tlLNtPy1EWcgFUBthJj7l","Guillotine","Guillotine",["Rory Webley"]]
["1kl741F4JVqW36Cte5kRg1","Miss Sunshine","Miss Sunshine",["Surfaces","Arden Jones"]]
["2zAi85TQB7mLzl8P1ySAj9","Lost Umbrella","ANTICYCLONE",["稲葉曇"]]
["63sm6eUdo7N7x415m53IOg","Lost Umbrella","Lost Umbrella",["Inaba Cumori"]]
["2yyS2kf61hr4mIOEGs9aDT","INVISIBLE","FUTURE PAST",["Duran Duran"]]
["7JQjSQiPjkAlZbIlrm5njS","FORGET YOU","FORGET YOU",["Dutch Melrose"]]
["7EQGXaVSyEDsCWKmUcfpLk","Die Young","Warrior (Expanded Edition)",["Kesha"]]
["5K2YU3ENuytMsx9bfJOFrw","Don't Matter","Vertigo",["Derik Fein"]]
["1poKogmbJOkn8im1EVdaKK","Mr Doctor","Mr Doctor",["Alex Robbins"]]
["13thc5VWwUrl8742RFyKry","Rock Bottom","Rock Bottom",["Justin Versluis"]]
["6L0x5u4A9AhwR6YQVKtiIg","Beautiful Lies - Sped Up","Beautiful Lies (Sped Up)",["Alex Robbins"]]
["3KR1JFRwYzha78aE9SpX3a","Im Doing Fine","Im Doing Fine",["Marino","Promoting Sounds"]]
["2ZDhEadCNyggLJWGETk7sQ","I Can't Fit In","I Can't Fit In",["Marino"]]
["3FdopY118eIYv5COjji7Sa","My Ordinary Life","My Ordinary Life",["The Living Tombstone"]]
["5tWRrxxojWZnSANWX1jV00","Nosebleed","Legalize Murder",["Frankie Linstrom"]]
["50TC8sIPWm2rYrMe54Q3Qh","Isis (Remix)","Remix God 2",["Versvs"]]
["6VfT8jrHkWOFkyEWjEhpFs","McDonald's in the Pentagon","McDonald's in the Pentagon",["Silly Stu"]]
["4dEKgwUQJpyOaXNtsZFuOS","blue - sped up","shades of blue",["yung kai"]]
["4kuPeLqTPXDkPB2injreCw","Omen","Caracal (Deluxe)",["Disclosure"]]
["5W10CyNhnCoIxUYfANwZqR","Accidentally In Love","Valentine's Day Mix",["Various Artists"]]
["3be9ACTxtcL6Zm4vJRUiPG","blue","blue",["yung kai"]]
["6UzrUSUTNjzKRhSyalzWNK","Kiss Me Again - Nightcore Mix","Kiss Me Again (Nightcore Mix)",["Roy Bee"]]
["0snQkGI5qnAmohLE7jTsTn","Toxicity","Toxicity",["System Of A Down"]]
["72SpPFrMYCXLB3Fbw9tEgf","Heaven","Heaven",["DJ Sammy","Yanou"]]
["52Zr0sinhWTCRrQhRRY4EP","Dragostea din tei","DiscO-Zone",["O-Zone"]]
["0gBfLS4aqbrr1ZvVv8dqWB","Stereo Love","Stereo Love",["Edward Maya","Vika Jigulina"]]
["4Xy8Puv18tPae91K8rxZt1","Виртуальная любовь","Виртуальная любовь",["Tanin Jazz"]]
["5uFYYOyT3EclOVhiFzPJSz","Rhythm Is a Dancer","The Madman's Return",["SNAP!"]]
["3iaj0MtII6VPVhwQa4eeX3","Qué Bien","Magia & Efectos Especiales",["IZAL"]]
["0yUsNnKCxe7r68qzEjbOaB","Carolina","Salir De Marcha",["Various Artists"]]
["6bvDI4KE66mLTYtNpASYpJ","CHAINS ON ME","CHAINS ON ME",["LaLion"]]
["6kOdk29M8h6ZfHz4byVG0t","PRETTY PLEASE","PRETTY PLEASE",["Dutch Melrose","benny mayne"]]
["3sNcqiOhQICcWx9a1zzLxG","Little Love","Little Love",["Corey Corner"]]
["1HDDVMmXutDZdzopbNLojC","4x4","The Bridge",["Versvs"]]
["3aXo6nJjexSdb6wCpN7Ysy","Redbone","Nova Tunes 3.5",["Various Artists"]]
["1BYaFbfu7XDd5bWbqLpuvE","Eleven","Eleven",["Furnace Woods"]]
["35TfkGcb6eecBVnHPJ7fWu","Spinning A Web","Little Prince",["Maz Univerze"]]
["0l3RoNpfMdfhmug2c8oe6q","Мой мармеладный (Я не права)","Джага-джага",["Katya Lel"]]
["5XFNqlrzTsU8hYIOw5mcug","Selfish","Selfish",["byjaye","Toby Hobart"]]
["4qqVcTHWEPVqv848QZZTYw","bored","bored",["Day Tvvo"]]
["1ZLroqJA8qoS5QEeCo0fA7","Breezeblocks","An Awesome Wave",["alt-J"]]
["4Y2uEMxni1MDrcJBDSWULX","Summer","Summer",["Good Kid"]]
["3VIJBrMpvimHEw5wtPh2wB","Money","Portamento",["The Drums"]]
["0TpJF2IIk9idRMJuSSXMLh","Aloe Lite","Good Kid 2",["Good Kid"]]
["0q6LuUqGLUiCPP1cbdwFs3","On Melancholy Hill","Plastic Beach",["Gorillaz"]]
["56NkIxSZZiMpFP5ZNSxtnT","Someday","Is This It",["The Strokes"]]
["6dBUzqjtbnIa1TwYbyw5CM","Lovers Rock","French Exit",["TV Girl"]]
["0BxE4FqsDD1Ot4YuBXwAPp","505","Favourite Worst Nightmare",["Arctic Monkeys"]]
["2x6iNna6wQexggFz8smJcB","Seventh Heaven","ALOHA INOHA",["INOHA"]]
["5hM5arv9KDbCHS0k9uqwjr","Borderline","The Slow Rush",["Tame Impala"]]
["2DrGEaqoruCSn0FffWCf5O","A-Punk","Vampire Weekend",["Vampire Weekend"]]
["1jJci4qxiYcOHhQR247rEU","Kids","Oracular Spectacular",["MGMT"]]
["0GO8y8jQk1PkHzS31d699N","Tongue Tied","Never Trust a Happy Song",["GROUPLOVE"]]
["7H7NyZ3G075GqPx2evsfeb","Chamber Of Reflection","Salad Days",["Mac DeMarco"]]
["6oofvZ4K8vBHnCT1oKERcd","i walk this earth all by myself","NEGATIVE",["EKKSTACY"]]
["58U47mHjyLwUwJZ7voUt15","One Day","Are You Alright?",["Lovejoy"]]
["7EAMXbLcL0qXmciM5SwMh2","Heart To Heart","Here Comes The Cowboy",["Mac DeMarco"]]
["4NgherJDfCXWBZBYheM4jK","WASTE","DISORDER",["KXLLSWXTCH"]]
["1ZgMsA55GIY7ICkQh5MILA","Space Song","Depression Cherry",["Beach House"]]
["0JIMT9gzLIIz0esKLyjbKf","Telephones","Changes",["Vacations"]]
["6QeYSvYqYUsfBzsApbjDHO","Cigarettes out the Window","Who Really Cares",["TV Girl"]]
["2R4AlwtrrkMaRKojcTIzmL","For the First Time","This Old Dog",["Mac DeMarco"]]
["1swz9stsbG1p34SJHJqiww","Murder on the Dancefloor - triple j Like A Version","Murder on the Dancefloor (triple j Like A Version)",["Royel Otis"]]

View File

@@ -6,8 +6,17 @@ MYDIR=$(dirname "$MYSELF")
. "$MYDIR"/get-tokens.sh
PLAYLIST_ID=${PLAYLIST_ID:-"2BoXyJeV0fhEHOy4uiByxr"}
TARGET=${TARGET:-}
if [ -z "$TARGET" ]; then
printf '\x1b[1;33m%s\x1b[0m\n' "W: No \$TARGET specified, using CWD"
TARGET=.
fi
i=0
PLAYLIST_JSON="$TARGET/playlist.json"
PLAYLIST_TXT="$TARGET/playlist.txt"
SUM_PLAYLIST_JSON="$TARGET/summary-playlist.json"
# i=0
iter_url=https://api.spotify.com/v1/playlists/$PLAYLIST_ID/tracks
while :; do
RES=$(curl --request GET \
@@ -18,20 +27,26 @@ while :; do
iter_url=$(jq -r .next <<< "$RES")
echo "$RES"
i=$((i+1))
# _=$((i++))
[[ "$iter_url" == "null" ]] && break
done \
| pv \
| jq .items \
| jq -s 'reduce .[] as $x ([]; . + $x)' \
| jq 'del(.. | .available_markets?, .added_by?, .popularity?)' > playlist.json
| jq 'del(.. | .available_markets?, .added_by?, .popularity?)' > "$PLAYLIST_JSON"
printf "downloaded %s songs metadata\n" "$(jq length playlist.json)"
ARR=" "$'\x1b'"[32m=>"$'\x1b'"[0m"
jq -r '.[].track | ( .name + " - " + (.album.artists | map(.name) | join(", ")) )' playlist.json \
> playlist.txt
printf "and dumped it as text on %s\n" playlist.txt
printf "$ARR downloaded \x1b[33m%s\x1b[0m songs metadata at \x1b[35m%s\x1b[0m\n" \
"$(jq length "$PLAYLIST_JSON")" "$PLAYLIST_JSON"
jq -c '.[].track | ( [.id, .name, .album.name, (.album.artists | map(.name))] )' playlist.json \
> summary-playlist.json
printf "AND dumped summary metadata on %s\n" summary-playlist.txt
jq -r '.[].track | ( .name + " - " + (.album.artists | map(.name) | join(", ")) )' "$PLAYLIST_JSON" \
> "$PLAYLIST_TXT"
printf "$ARR dumped it as text on \x1b[35m%s\x1b[0m\n" "$PLAYLIST_TXT"
jq -c '.[].track | ( [.id, .name, .album.name, (.album.artists | map(.name))] )' "$PLAYLIST_JSON" \
> "$SUM_PLAYLIST_JSON"
printf "$ARR dumped summary metadata on \x1b[35m%s\x1b[0m\n" "$SUM_PLAYLIST_JSON"
printf "Dupped Songs:\n"
sort < "$PLAYLIST_TXT" | uniq -d