Compare commits
12 Commits
ff36e65ed7
...
master
Author | SHA1 | Date | |
---|---|---|---|
6f37b5f9b4
|
|||
3d360a41f7
|
|||
bd8b0c3cca
|
|||
546d645a0e
|
|||
c63dd8a7d3
|
|||
8ec3192f0d
|
|||
cf2486f549
|
|||
dbeb324937
|
|||
9be553d370
|
|||
1bdaeebf97
|
|||
ae097bfc8d
|
|||
32e75a9082
|
@@ -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
|
||||
|
14878
spotify/playlist.json
14878
spotify/playlist.json
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
@@ -324,7 +324,7 @@ Fall Away - Twenty One Pilots
|
||||
The Pantaloon - Twenty One Pilots
|
||||
Addict With A Pen - Twenty One Pilots
|
||||
Friend, Please - Twenty One Pilots
|
||||
March To The Sea - Twenty One Pilots
|
||||
March To the Sea - Twenty One Pilots
|
||||
Cancer - Twenty One Pilots
|
||||
Wonderwall - Oasis
|
||||
Zombie (Acoustic) - Bad Wolves
|
||||
@@ -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
|
||||
@@ -1118,3 +1118,149 @@ Samba do Brasil - Bellini
|
||||
UNDEAD - YOASOBI
|
||||
Wake Up - Cheese People
|
||||
sex - EDEN
|
||||
Strangers - Kenya Grace
|
||||
Just A Girl - No Doubt
|
||||
Sailor Song - Gigi Perez
|
||||
Not My Problem - Laila!
|
||||
APT. - ROSÉ, Bruno Mars
|
||||
Snowman - Sia
|
||||
Story - ghstpunk
|
||||
Hazy Skyscraper - DEMONDICE
|
||||
Wannabe - DEMONDICE
|
||||
fake ass gold - DEMONDICE
|
||||
wanting, getting, wanting - DEMONDICE
|
||||
dark hour - DEMONDICE
|
||||
Alkatraz - DEMONDICE
|
||||
Suckerz - DEMONDICE
|
||||
From The Start - Laufey
|
||||
Night Sweats - Emcee KB
|
||||
Babydoll - Dominic Fike
|
||||
Friendly Neighborhood Poltergeist - Rory Webley
|
||||
legroom - adan diaz
|
||||
i walk this earth all by myself - EKKSTACY
|
||||
I Deserve to Bleed - Sushi Soucy
|
||||
Disco - Surf Curse
|
||||
Water Fountain - Alec Benjamin
|
||||
don't miss me - Claire Rosinkranz
|
||||
If I Killed Someone For You - Alec Benjamin
|
||||
Dancin by Herself - NOIRION, O R I O N
|
||||
Animal - Sir Chloe
|
||||
i met sarah in the bathroom - awfultune
|
||||
dumb dumb - mazie
|
||||
Treehouse - Alex G
|
||||
lovely (with Khalid) - Billie Eilish, Khalid
|
||||
Money - Mystery Skulls
|
||||
Ghost - Mystery Skulls
|
||||
Your Reality - Dan Salvato
|
||||
ADDERALL HIGH - AUGY
|
||||
Children of the City - Mili
|
||||
SAD! - XXXTENTACION
|
||||
come undone - suzie
|
||||
Fortunate Son - Creedence Clearwater Revival
|
||||
Self Control - Laura Branigan
|
||||
6ix 6trings - byjaye
|
||||
Bad Blood - Taylor Swift
|
||||
Money Game - Ren
|
||||
Money Game, Pt. 2 - Ren
|
||||
Money Game, Pt. 3 - Ren
|
||||
BIRDS OF A FEATHER - Billie Eilish
|
||||
positions - Ariana Grande
|
||||
R U Mine? - Arctic Monkeys
|
||||
Hot N Cold - Katy Perry
|
||||
Shiny Happy People - R.E.M.
|
||||
2step - Ed Sheeran
|
||||
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
|
||||
|
1266
spotify/summary-playlist.json
Normal file
1266
spotify/summary-playlist.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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,16 +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 \
|
||||
| pv > 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 -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
|
||||
|
Reference in New Issue
Block a user