Compare commits
2 Commits
dbeb324937
...
8ec3192f0d
Author | SHA1 | Date | |
---|---|---|---|
8ec3192f0d | |||
cf2486f549 |
@ -13,7 +13,7 @@ export BEARER_TOKEN
|
|||||||
GUEST_TOKEN_RES=$(
|
GUEST_TOKEN_RES=$(
|
||||||
curl -sX POST https://clienttoken.spotify.com/v1/clienttoken \
|
curl -sX POST https://clienttoken.spotify.com/v1/clienttoken \
|
||||||
-H "Accept: application/json" -H "content-type: application/json" \
|
-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"}}}'
|
--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
|
if ! [[ "$(echo "$GUEST_TOKEN_RES" | jq -r .response_type)" == "RESPONSE_GRANTED_TOKEN_RESPONSE" ]]; then
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1172,3 +1172,16 @@ Shiny Happy People - R.E.M.
|
|||||||
SNAP - Rosa Linn
|
SNAP - Rosa Linn
|
||||||
Painkiller - Beach Bunny
|
Painkiller - Beach Bunny
|
||||||
Painkiller - Ruel
|
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
|
||||||
|
@ -1172,3 +1172,16 @@
|
|||||||
["5hx7w26Zi3zafMgvMTUqF6","SNAP","SNAP",["Rosa Linn"]]
|
["5hx7w26Zi3zafMgvMTUqF6","SNAP","SNAP",["Rosa Linn"]]
|
||||||
["415aR5b8Uws9UPGTsssWaS","Painkiller","Prom Queen",["Beach Bunny"]]
|
["415aR5b8Uws9UPGTsssWaS","Painkiller","Prom Queen",["Beach Bunny"]]
|
||||||
["1YlulsUKDduOmC7WxvXYPW","Painkiller","Free Time",["Ruel"]]
|
["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"]]
|
||||||
|
@ -6,8 +6,17 @@ MYDIR=$(dirname "$MYSELF")
|
|||||||
. "$MYDIR"/get-tokens.sh
|
. "$MYDIR"/get-tokens.sh
|
||||||
|
|
||||||
PLAYLIST_ID=${PLAYLIST_ID:-"2BoXyJeV0fhEHOy4uiByxr"}
|
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
|
iter_url=https://api.spotify.com/v1/playlists/$PLAYLIST_ID/tracks
|
||||||
while :; do
|
while :; do
|
||||||
RES=$(curl --request GET \
|
RES=$(curl --request GET \
|
||||||
@ -18,20 +27,23 @@ while :; do
|
|||||||
iter_url=$(jq -r .next <<< "$RES")
|
iter_url=$(jq -r .next <<< "$RES")
|
||||||
echo "$RES"
|
echo "$RES"
|
||||||
|
|
||||||
i=$((i+1))
|
# _=$((i++))
|
||||||
[[ "$iter_url" == "null" ]] && break
|
[[ "$iter_url" == "null" ]] && break
|
||||||
done \
|
done \
|
||||||
| pv \
|
| pv \
|
||||||
| jq .items \
|
| jq .items \
|
||||||
| jq -s 'reduce .[] as $x ([]; . + $x)' \
|
| 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 \
|
printf "$ARR downloaded \x1b[33m%s\x1b[0m songs metadata at \x1b[35m%s\x1b[0m\n" \
|
||||||
> playlist.txt
|
"$(jq length "$PLAYLIST_JSON")" "$PLAYLIST_JSON"
|
||||||
printf "and dumped it as text on %s\n" playlist.txt
|
|
||||||
|
|
||||||
jq -c '.[].track | ( [.id, .name, .album.name, (.album.artists | map(.name))] )' playlist.json \
|
jq -r '.[].track | ( .name + " - " + (.album.artists | map(.name) | join(", ")) )' "$PLAYLIST_JSON" \
|
||||||
> summary-playlist.json
|
> "$PLAYLIST_TXT"
|
||||||
printf "AND dumped summary metadata on %s\n" summary-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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user