Skip to content

Instantly share code, notes, and snippets.

@lupettohf
Created August 2, 2014 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lupettohf/7f97be92a43693c7191e to your computer and use it in GitHub Desktop.
Save lupettohf/7f97be92a43693c7191e to your computer and use it in GitHub Desktop.
Simple downloader for bandcamp
# -*- coding:utf-8 -*-
# ___. .___
# \_ |__ _____ ____ __| _/____ _____ _____ ______
# | __ \\__ \ / \ / __ |/ ___\\__ \ / \\____ \
# | \_\ \/ __ \| | \/ /_/ \ \___ / __ \| Y Y \ |_> >
# |___ (____ /___| /\____ |\___ >____ /__|_| / __/
# \/ \/ \/ \/ \/ \/ \/|__| Downloader!
#Creative Commons Attribution-ShareAlike 4.0 International License.
import re
import urllib2
__author__ = 'lupettohf'
__version__ = '1.0'
#re
audior = '"mp3-128":"(.*?)"}'
# Download page source
url = raw_input("Bandcamp Link:")
down = urllib2.urlopen(url)
data= down.read()
# Parse link
audiofile = re.compile(audior).search (data)
# Save as
name = raw_input("Save as:")
# Download and save
print("Downloading %s.mp3" %name)
with open(name + ".mp3",'wb') as x:
x.write(urllib2.urlopen(audiofile.group(0)).read())
x.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment