10-30-2017, 10:07 PM
Greetings my friends. I know that a little or some of you are fans of indie artists or disc jockeys at bandcamp. Well, ever thought of getting the albums and playlists in mp3 format for free?
Well here is one of the scripts I have made during my spare time when I became obsessed with the site and the music they produce. I have been using this code for almost a year now and feel free to use it.
Tools of trade:
- Python
- youtube-dl
- BeautifulSoup (python library)
- urllib2 (python library)
Source code (Python 2.7.x):
Steps:
1.) Install python, the two important libraries and its prerequisites.
2.) Install youtube-dl, and its prerequisites.
3.) Change YOURARTIST using your target artist.
4.) Kindly double click it or execute it via command-line to see the logs.
5.) Once download has been started, you will notice that it will create a directory where the source code is and it will create folders of each album then place each song to its respective album.
Notes to be aware of:
This script was tested using Cygwin, WSL (Windows Subsystem for Linux), Xubuntu, Ubuntu, Gentoo, and Slackware. Haven't tried it on other operating systems so feel free to use my code. Please do enhance and make the source code much better because sometimes this does not work if the bandcamp artist is using a custom theme (by default this works on most of the artist pages) or you have reached your maximum internet usage or bandwidth (Lols.
). Please do reply to my thread for further questions and suggestions. Thank you very much for reading my thread. 
Credits To:
- Vector and Enmafia2 for encouraging me to post a thread and for helping me cope up with my anxiety.
- To the authors of python and extended libraries from the pip repository.
- To the authors of youtube-dl and its prerequisites.
- Bandcamp's developers who did not notice this simple security hole.
Well here is one of the scripts I have made during my spare time when I became obsessed with the site and the music they produce. I have been using this code for almost a year now and feel free to use it.

Tools of trade:
- Python
- youtube-dl
- BeautifulSoup (python library)
- urllib2 (python library)
Source code (Python 2.7.x):
Code:
#!/usr/bin/python
from BeautifulSoup import BeautifulSoup as bs
import urllib2, re, os
artist_link = "https://YOURARTIST.bandcamp.com"
album_dict = {}
src = bs(urllib2.urlopen(artist_link + "/music"))
for link in src.findAll("a", attrs={"href" : re.compile("/album/")}):
str_link = str(link.get("href"))
key = str_link.replace("/album/", "")
val = artist_link + str_link
albums_dict[key] = val
for album in albums_dict:
if not os.path.exists(album) and not os.path.isdir(album):
cmd = "youtube-dl -o \"./"
cmd += album + "/"
cmd += "%(playlist_index)s %(title)s.%(ext)s\" "
cmd += albums_dict[album]
os.mkdir(album)
os.system(cmd)
Steps:
1.) Install python, the two important libraries and its prerequisites.
2.) Install youtube-dl, and its prerequisites.
3.) Change YOURARTIST using your target artist.
4.) Kindly double click it or execute it via command-line to see the logs.
5.) Once download has been started, you will notice that it will create a directory where the source code is and it will create folders of each album then place each song to its respective album.
Notes to be aware of:
This script was tested using Cygwin, WSL (Windows Subsystem for Linux), Xubuntu, Ubuntu, Gentoo, and Slackware. Haven't tried it on other operating systems so feel free to use my code. Please do enhance and make the source code much better because sometimes this does not work if the bandcamp artist is using a custom theme (by default this works on most of the artist pages) or you have reached your maximum internet usage or bandwidth (Lols.


Credits To:
- Vector and Enmafia2 for encouraging me to post a thread and for helping me cope up with my anxiety.
- To the authors of python and extended libraries from the pip repository.
- To the authors of youtube-dl and its prerequisites.
- Bandcamp's developers who did not notice this simple security hole.