Skip to content

Instantly share code, notes, and snippets.

@willwillis
Created November 7, 2025 05:03
Show Gist options
  • Select an option

  • Save willwillis/b8bb88b4dd003e6c71d0fd7fe42ab510 to your computer and use it in GitHub Desktop.

Select an option

Save willwillis/b8bb88b4dd003e6c71d0fd7fe42ab510 to your computer and use it in GitHub Desktop.
url to bandcamp download
bandcamp_download() {
local url="$1"
# Extract subdomain (everything before .bandcamp.com)
local subdomain=$(echo "$url" | sed -n 's|^https\?://\([^.]*\)\.bandcamp\.com.*|\1|p')
if [ -z "$subdomain" ]; then
echo "Error: Could not extract subdomain from URL" >&2
return 1
fi
echo "Downloading from artist: $subdomain"
bandcamp-dl --artist "$subdomain" --base-dir ~/Music/bandcamp.com/ "$url"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment