Add bandcamp_download_all

This commit is contained in:
Micyp
2021-10-29 19:58:47 +02:00
parent 4d896c726d
commit 5bef549fdf

31
bandcamp_download_all Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/bash
source bashcols.inc
html=$1
output=${2:-.}
links=$(tidy 2>/dev/null "$html" | grep -oE 'https://p4\.bcbits.com/download/.*>D' | sed 's/">D$//')
cyan echo "Parsed links:"
echo "$links"
echo
read -p "Continue? [Y/n] " CHOICE
if [[ -z $CHOICE || $CHOICE =~ ^[yY] ]]; then
while read -r link; do
if [[ -z $link ]]; then
continue
fi
if grep -F "/album/" <<<"$link"; then
ext=".zip"
else
ext=".flac"
fi
name="$(cut -d'/' -f6 <<<"$link")${ext}"
cyan echo "Downloading: ${link} => ${output}/${name}"
wget "${link}" -O "${output}/${name}"
done<<<"$links"
else
echo "Aborting"
fi