Download your bandcamp collection using this python script.

Overview

bandcamp-downloader

Download your Bandcamp collection using this python script.

It requires you to have a browser with a logged in session of bandcamp open. Cookies from the browser will be used to authenticate with Bandcamp.

Supported browsers are the same as in browser_cookie3: Chrome, Chromium, Firefox, Brave, Opera, and Edge

Albums will be downloaded into their zip files and singles will just be plain files. Downloads are organized by Artist name. Already existing files of the same name will have their file sizes checked against what it should be, and if they are the same, the download will be skipped, otherwise it will be over-written. You can use the --force flag to always overwrite existing files.

Downloads will happen in parallel, by default using a pool of 5 threads. You can configure how many threads to use with the --parallel-downloads/-p flag. After each download a thread will wait 1 second before trying the next download. This is to try and not overwhelm (and be rejected by) the bandcamp servers. This can be configured with the --wait-after-download flag.

If a download should fail because of an HTTP/network error, it will be retried again after a short wait. By default a file download will be attempted at most 5 times. This can be configured with the --max-download-attempts flag. By default, a failed download will wait 5 seconds before trying again. This can be configured by the --retry-wait flag.

By default, files are downloaded in mp3-320 format, but that can be changed with the --format/-f flag.

Known Issues

Failure to read cookies on Windows for Chrome/Chromium/Brave

This is a known issue with the browser-cookie3 module. I've submitted a PR to fix it here. In the meantime, firefox should still work fine, and I have created a branch here with a patched browser_cookie3 module that should work.

Running the script on WSL crashes with a DBUS_SESSION_BUS_ADDRESS error

This is seems to be a WSL issue. The browser_cookie3 module tries to get a secret from your keyring via dbus, but WSL may not have dbus installed, or may not have it set up as expected. As such, you may see the following error:

secretstorage.exceptions.SecretServiceNotAvailableException: Environment variable DBUS_SESSION_BUS_ADDRESS is unset

Please either check your WSL dbus installation/configuration, or run the script nativity on windows.

Manual Setup

Install the script dependencies by running:

pip install -r requirements.txt

Run the program:

./bandcamp-downloader.py [arguments]

Setup via Poetry

Install requirements using Python Poetry. Installation instructions here.

poetry install

Run the script within the poetry shell:

poetry shell
python bandcamp-downloader.py [arguments]

or directly through poetry run:

poetry run python bandcamp-downloader.py [arguments]

Usage

usage: bandcamp-downloader.py [-h]
                              [--browser {firefox,chrome,chromium,brave,opera,edge}]
                              [--directory DIRECTORY]
                              [--format {aac-hi,aiff-lossless,alac,flac,mp3-320,mp3-v0,vorbis,wav}]
                              [--parallel-downloads PARALLEL_DOWNLOADS]
                              [--force]
                              [--wait-after-download WAIT_AFTER_DOWNLOAD]
                              [--max-download-attempts MAX_DOWNLOAD_ATTEMPTS]
                              [--retry-wait RETRY_WAIT] [--verbose]
                              username

Download your collection from bandcamp. Requires a logged in session in a
supported browser so that the browser cookies can be used to authenticate with
bandcamp. Albums are saved into directories named after their artist. Already
existing albums will have their file size compared to what is expected and re-
downloaded if the sizes differ. Otherwise already existing albums will not be
re-downloaded.

positional arguments:
  username              Your bandcamp username

optional arguments:
  -h, --help            show this help message and exit
  --browser {firefox,chrome,chromium,brave,opera,edge}, -b {firefox,chrome,chromium,brave,opera,edge}
                        The browser whose cookies to use for accessing
                        bandcamp. Defaults to "firefox"
  --directory DIRECTORY, -d DIRECTORY
                        The directory to download albums to. Defaults to the
                        current directory.
  --format {aac-hi,aiff-lossless,alac,flac,mp3-320,mp3-v0,vorbis,wav}, -f {aac-hi,aiff-lossless,alac,flac,mp3-320,mp3-v0,vorbis,wav}
                        What format do download the songs in. Default is
                        'mp3-320'.
  --parallel-downloads PARALLEL_DOWNLOADS, -p PARALLEL_DOWNLOADS
                        How many threads to use for parallel downloads. Set to
                        '1' to disable parallelism. Default is 5. Must be
                        between 1 and 32
  --force               Always re-download existing albums, even if they
                        already exist.
  --wait-after-download WAIT_AFTER_DOWNLOAD
                        How long, in seconds, to wait after successfully
                        completing a download before downloading the next
                        file. Defaults to '1'.
  --max-download-attempts MAX_DOWNLOAD_ATTEMPTS
                        How many times to try downloading any individual files
                        before giving up on it. Defaults to '5'.
  --retry-wait RETRY_WAIT
                        How long, in seconds, to wait before trying to
                        download a file again after a failure. Defaults to
                        '5'.
  --verbose, -v

Development and Contributing

When modifying required packages, please:

  • Add to Poetry (poetry add)
  • Then update the requirements.txt (poetry run pip freeze > requirements.txt)
  • Commit all updated files

Notes

If you have a logged in session in the browser, have used the --browser/-b flag correctly, and still are being told that the script isn't finding any albums, check out the page for browser_cookie3, you might need to do some configuring in your browser to make the cookies available to the script.

If you are downloading your collection in multiple formats, the script can't tell if an already downloaded zip file is the same format or not, and will happily overwrite it. So make sure to use different directories for different formats, either by running the script somewhere else or by supplying directories to the --directory/-d flag.

Comments
  • WinError 123 while downloading

    WinError 123 while downloading

    Downloading my collection, I encountered this error

    Traceback (most recent call last):
      File "D:\Programmi\BandcampCollectionDownloader\bandcamp-downloader.py", line 235, in <module>
        sys.exit(main())
      File "D:\Programmi\BandcampCollectionDownloader\bandcamp-downloader.py", line 111, in main
        download_album(link)
      File "D:\Programmi\BandcampCollectionDownloader\bandcamp-downloader.py", line 184, in download_album
        download_file(download_url, artist)
      File "D:\Programmi\BandcampCollectionDownloader\bandcamp-downloader.py", line 212, in download_file
        os.makedirs(os.path.dirname(file_path), exist_ok=True)
      File "C:\Users\ricca\AppData\Local\Programs\Python\Python39\lib\os.py", line 215, in makedirs
        makedirs(head, exist_ok=exist_ok)
      File "C:\Users\ricca\AppData\Local\Programs\Python\Python39\lib\os.py", line 225, in makedirs
        mkdir(name, mode)
    OSError: [WinError 123] La sintassi del nome del file, della directory o del volume non è corretta: 'D:\\Programmi\\BandcampCollectionDownloader\\
    

    I don’t know what causes it, but it should be noted that my collection is full of vaporwave albums (so there’s a lot of Unicode in there)

    opened by ZinRicky 6
  • Dean/package manage with poetry

    Dean/package manage with poetry

    This change manages required packages and Python version using Poetry. The reasons I'm suggesting this change are:

    • Fully automates package installation.
    • Installs the correct version of Python for this project.
    • Keeps everything inside a virtual environment just for this project, avoiding conflicts with other projects.

    This doesn't prevent a user from running the script on their local installation, if they desire.

    Give it a try, let me know what you think!

    opened by deanputney 4
  • Error

    Error

    Get this when trying to run.

    File "/Users/ajcowell/Downloads/bandcamp-downloader-master/./bandcamp-downloader.py", line 318, in sys.exit(main()) File "/Users/ajcowell/Downloads/bandcamp-downloader-master/./bandcamp-downloader.py", line 134, in main links = get_download_links_for_user(args.username) File "/Users/ajcowell/Downloads/bandcamp-downloader-master/./bandcamp-downloader.py", line 186, in get_download_links_for_user 'collection_count' : data['collection_count'],

    opened by ajcowell 1
  • Pulling links from the hidden items section

    Pulling links from the hidden items section

    When I try to download my collection, it also pull some links from the hidden section.

    my collection_count should only be 20 so that means it should only download 20, right?

    collection

    But it's downloading 40 links for some reason.

    downloader

    I know that hiding items somewhat works because before hiding the downloader was pulling 170 items.

    hidden

    opened by 8N7D2o 0
  • Error Downloading Albums Purchased With Separate Email

    Error Downloading Albums Purchased With Separate Email

    This is a user-ish error, but it may help someone in the future, so I figured I'd post anyway.

    Some of my albums were purchased using a separate email. After running Bandcamp-Downloader, I noticed 5 errors like this:

    "ERROR: An exception occurred trying to download file url []: 'content-disposition'(<class 'KeyError'>, KeyError('content-disposition'), <traceback object at 0x000001D1470220C0>)"

    The fix is to simply add your alternate payment email to your account. More info here: https://get.bandcamp.help/hc/en-us/articles/360007803614-Some-of-my-purchases-are-missing-from-my-collection-What-do-I-do-

    Perhaps the script could simply throw that information along with the error?

    opened by OldZisty 1
  • Additional Resources

    Additional Resources

    Just came across this, and figured I'd link a few other similar projects I've referenced/used previously. Please feel free to close this issue, but figured this would be the easiest way to comment with references: https://github.com/the-eater/camp-collective https://michaelherger.github.io/Bandcamp-API/ https://github.com/impliedchaos/mopidy-bandcamp https://github.com/Virusmater/plugin.audio.kxmxpxtx.bandcamp/blob/master/resources/lib/bandcamp_api/bandcamp.py

    opened by Peter200lx 1
Owner
null
A collection of modules I have created to programmatically search for/download imagery from live cam feeds across the state of California.

A collection of modules that I have created to programmatically search for/download imagery from all publicly available live cam feeds across the state of California. In no way am I affiliated with any of these organizations and these modules/methods of gathering imagery are completely unofficial.

Chad Groom 5 Nov 21, 2022
Simple Python script to download images and videos from public subreddits without using Reddit's API 😎

Subreddit Media Downloader Download images and videos from any public subreddit without using Reddit's API Made with ❤ by Nico ?? About: This script a

Nico 106 Jan 7, 2023
Python script designed to search and fetch direct download links from nxbrew.com

SwitchGamesDownloader Only for windows nxbrew.com is a website, accessible only using a proxy, where the majority of games for the Nintendo Switch are

Backend 91 Dec 28, 2022
A Python script that allows you to download all of an anime's episodes at once.

BitAnime A Python script that allows you to download all of an anime's episodes at once. · Download executable version · About BitAnime BitAnime is a

sh1nobu 17 Aug 10, 2022
Python script to download all images/webms of a 4chan thread

Python3 script to continuously download all images/webms of multiple 4chan thread simultaneously - without installation

Micha Fink 208 Jan 4, 2023
Simple python script to download .mp3 formatted files from YouTube video URLs

Introduction: Simple python script to download .mp3 formatted files from YouTube video URLs Requirements: Requires: youtube_dl module Requires: ffmpeg

Pat 2 Aug 18, 2022
Python script to download entire campaign images and navigation.

Squidle campaign downloader Python script to download entire campaign images and navigation. usage: squidle_campaign_downloader.py [-h] [--api-token A

Miquel Massot 2 Nov 17, 2021
This is a simple Python Script to download Imgur Pictures with the short url!

Imgur Downloader This is a simple Python Script that runs a process with progress bar that downloads an Imgur Picture! Code Example Features Progress

OGMatrix 1 Nov 18, 2021
A simple Python +3.x script to download videos from Facebook.

Facebook Video Downloader A simple Python +3.x script to download videos from Facebook posts

Kerolos Atef Saber 1 Dec 3, 2021
This simple Python script allows you to download songs on Telegram🌸❤️😁

SongsDownloaderTgBot ?? YouTube Song Downloader Bot For Telegram ?? 3X Fast Telethon Based Bot ⚜ Open Source Bot ????‍?? Demo : ?????????? - ?????????

Sehath Perera 23 Dec 3, 2022
A manga download script written in python.

manga-dlp python script to download mangas Description A manga download script written in python. It only supports mangadex.org for now. But support f

Ivan Schaller 15 Nov 28, 2022
Python script to download (TCR) genes from IMGT/GENE-DB

IMGTgeneDL 0.1.0 Jamie Heather | CCR @ MGH | 2021 This script provides an alternative way to access TCR and IG genes stored in IMGT/GENE-DB. It's prim

Jamie Heather 1 Mar 30, 2022
A Python script to download PDB files associated with a Portable Executable (PE)

A Python script to download PDB files associated with a Portable Executable (PE)

Podalirius 33 Jan 3, 2023
Jocomol 16 Dec 12, 2022
Script that allows to download portable installers of different versions Adobe software for macOS

What is this and for what This is a script that allows you to download portable installers of programs from Adobe for macOS with different versions. T

null 715 Jan 6, 2023
📼Command line tool based on youtube-dl to easily download selected channels from your subscriptions.

youtube-cdl Command line tool based on youtube-dl to easily download selected channels from your subscriptions. This tool is very handy if you want to

Anatoly 64 Dec 25, 2022
Download all your URI Online Judge source codes and upload to GitHub with simple steps.

URI-Code-Downloader Download all your URI Online Judge source codes and upload to GitHub with simple steps. Prerequisites Python 3.x Installing Downlo

Luan Simões 9 Mar 23, 2022
Download YOUR files, documents from vk.

vk-documents-downloader Кароч эта симпл херня качает все ВАШИ документы с вк. Или я еблан, но в гх и тмб гугле я подобного не нашел. py main.py Login:

null 4 Jun 10, 2022
Noto fonts go universal! Download Noto fonts combined to suit your region

noto-cjk Noto CJK fonts Noto Serif CJK update was released on 25 October 2021. We moved the release history and other notes into both Sans and Serif s

Google Fonts 2k Jan 2, 2023