Created
September 4, 2017 10:36
-
-
Save alejandroandreu/a488b8d99ea63904b6bdb784dd52055a to your computer and use it in GitHub Desktop.
Download any user's Bandcamp wishlist via youtube-dl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Don't do anything if youtube-dl is not installed | |
which youtube-dl >/dev/null || ( echo "Aborting, youtube-dl is not installed!" >&1 && exit 1; ) | |
# Main vars | |
user="alejandroandreu" | |
baseurl="https://bandcamp.com/${user}/wishlist" | |
targetdir="~/Music/Wishlist" | |
# Each item in wishlist is represented in the HTML like: | |
# <a class="fav-track-link" href="https://dodjoma.bandcamp.com/album/syntropia-ep" target="_blank">Là</a> | |
htmlclass="fav-track-link" | |
# Download each album | |
albums=$(curl -s $baseurl | grep $htmlclass | cut -d "=" -f 3 | cut -d " " -f 1 | tr -d '"') | |
for album in $albums; do | |
artist=$(echo $album | cut -d "/" -f 3 | cut -d "." -f 1) # Artist can't be retrieved reliably by youtube-dl | |
echo "[+] Downloading ${album}..." | |
youtube-dl -w -o "${targetdir}/${artist^}"' - %(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' $album | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thank you for this.
I've set htmlclass variable to 'item-link' to match the current version of the html but it only loads elements before the 'view all items' button. Is it possible to modify the script to work with the actual version of bandcamp?