#!/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