2 YTM to Textbox
tengel edited this page 2024-09-05 08:27:27 -05:00

Google Play -> Youtube Music -> Spotlistr

#!/usr/bin/env bash

# build import list for spotlistr

## Screen Scrape to file
# 1. Open YTM playlist in browser
# 2. Scroll down to end, forces "lazy load" to load all tracks
# 3. Ctrl-a, Ctrl-c then Ctrl-v to file
# 4. Delete first few (~8) lines until it starts with first song
#    - 4 lines per song (title artist album time)
# 5. Save and run through this script, creates <file>.tbox
# 6. Paste <file>.tbox into https://www.spotlistr.com/search/textbox

# the screen-scrape saved filename is the input
YTM="$1"

sed '/:[0-9]\{2\}$/{G;}' "${YTM}" > "${YTM}.tmp"
sed -i 's/,/;/' "${YTM}.tmp"
sed -E 'H;${x;s/(.)\n/\1,/g}' "${YTM}.tmp" | grep -F ',' > "${YTM}.csv"
awk -F, '{OFS=",";print $2 " - " $1}' "${YTM}.csv" > "${YTM}.tbox"