random

- collection of un-sorted bollocks
git clone git://git.acid.vegas/random.git
Log | Files | Refs | Archive

bandcamp.py (661B)

      1 #!/usr/bin/env python
      2 # developed by acidvegas in python (https://acid.vegas/random)
      3 import re,sys,urllib.request
      4 if len(sys.argv)!=2:raise SystemExit('error: invalid arguments')
      5 source=urllib.request.urlopen(f'https://{sys.argv[1]}.bandcamp.com/music').read().decode('utf-8')
      6 for album in re.compile('<a href="/album/(.*?)">').findall(source):
      7 	print(f'found album "{album}"')
      8 	source=urllib.request.urlopen(f'http://downloadbandcamp.com/{sys.argv[1]}.bandcamp.com/album/{album}').read().decode('utf-8')
      9 	for song in re.findall('(https?://t4\S+).*download="(.*?)"',source):
     10 		print(f'downloading "{song[1]}"')
     11 		urllib.request.urlretrieve(song[0][:-1],song[1])