Skip to content

Instantly share code, notes, and snippets.

@cab404 cab404/bandcamp-dl.sh
Last active Jan 2, 2018

Embed
What would you like to do?
bandcamp album download script
#!/bin/bash
# Made by cab404
# Licenced under GPLv3 (http://www.gnu.org/licenses/gpl-3.0.html)
# Musicians need food too, please pay for everything you download. Or at least something.
echo 'loading info'
wget $1 -qO- | grep 'trackinfo' > data.txt
OUTDIR=$(echo $1 | sed 's/\//\n/g' | sed '/^$/d' | tail -n 1)
mkdir $OUTDIR
TMP=/tmp/.bcdlxargp
URLS=$(cat data.txt | grep -Po '(mp3-128":".*})' | sed 's/"/\n/g' | grep 'popplers')
cat data.txt | sed 's/},/\n/g;s/,"/\n/g' | grep -Po '(?<=title":").*(?=")' > tracklist.txt
rm data.txt
echo "downloading to "$OUTDIR
echo "==== track list ===="
cat tracklist.txt
echo "====-==-====-==-===="
N=0
for URL in $URLS; do
N=$(dc -e "$N 1 + p")
MP3NUM=$N
MP3NAME=$(head tracklist.txt -n $N | tail -n 1)
FILENAME="$OUTDIR/${MP3NUM}. ${MP3NAME}.mp3"
echo "wget -qc --show-progress --output-document=\"$FILENAME\" \"http:$URL\" |" >> $TMP
done
echo "echo downloading now" >> $TMP
bash $TMP
echo "complete"
rm $TMP
@cab404

This comment has been minimized.

Copy link
Owner Author

cab404 commented Oct 21, 2015

This thing downloads album by it's url.
'mediainfo' package should be installed.

@cab404

This comment has been minimized.

Copy link
Owner Author

cab404 commented Oct 21, 2015

Now it doesn't need 'mediainfo'.

@cab404

This comment has been minimized.

Copy link
Owner Author

cab404 commented Oct 21, 2015

Now it makes directory for album

@cab404

This comment has been minimized.

Copy link
Owner Author

cab404 commented Nov 14, 2015

Now it works for singles

@cab404

This comment has been minimized.

Copy link
Owner Author

cab404 commented Nov 14, 2015

~like me

@r0om3

This comment has been minimized.

Copy link

r0om3 commented Jan 2, 2018

Hi, I'm new to Linux and I'd like to know how to use the script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.