Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Create list file from webpage <album title, urls, titles>
- #!/bin/bash
- curl -s http://etherealuniverse.bandcamp.com/album/ethereal-universe-vol-10 > page.html
- cat page.html | grep 'link rel' | grep 'album' | sed -ne 's/.*title=\"\(.*\)" href.*/albumtitle=\1/p' > list
- cat page.html | grep 'trackinfo :' | sed 's/.$//' | sed 's/^.*: //' | jq '.[].file[], .[].title' >> list
- # Process list file with python (load album title into variable, flatten urls and titles into one list)
- # then call curl (url redirect enabled) to download the mp3
- #!/usr/bin/env python2.7
- import os
- import sys
- fd = open("list", "r");
- urllist=[]
- titlelist=[]
- for l in fd:
- y = l.replace('\n', '')
- if "http" in y:
- urllist.append(y)
- elif "albumtitle" in y:
- albumtitle = y.replace("albumtitle=", "")
- else:
- y = y.replace("\"", "")
- titlelist.append(y)
- print albumtitle
- os.mkdir(albumtitle)
- for i in range(len(urllist)):
- title = titlelist[i]
- url = urllist[i]
- cmd = "curl -L -s " + url + " > \"" + albumtitle + "/"+ title + ".mp3\""
- print "Downloading %s/%s" % (albumtitle, title)
- os.system(cmd)
- fd.close()
- Example list output:
- albumtitle=Ethereal Universe: Ethereal Universe Vol 10
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=9f196f095a416cec043ddb4dc73d15b8&id=4266534932&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=6abb9d6f9ed3499320237831dbe80e46&id=1922216492&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=73ced2d9f64d5f20c91321dd9d8b4e45&id=999226868&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=c3406f2f8ad3110e2262bc7c7d88276d&id=136248659&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=d6e365c2886fed8143fdcac2d735a6d5&id=1756742211&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=4e7911ea3257374d4d0dbf0b21b078ad&id=2211090495&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=6c072609a038767607809b28469e29ea&id=2501189368&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=9ad9b17c10424e9afb8a4116435a64ba&id=977675853&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=b5fce1d559b7381aa33938cf18b3e0ac&id=1937966401&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=1175ca548cacb6343c39447db4043ebe&id=956569864&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=72250346fc5a5540b1f43dbd370f0753&id=3273441571&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=27a251a6b61326e204f16f33b3be759a&id=1481419656&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=a376055a52e3fb23c97e78d0e17e9dfe&id=1002935646&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=68e63371cd77812c4ccf50c7fdb3a668&id=220889560&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=75718b309ff447743498ad5aefdf4676&id=3092831564&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=0e38340bbedd944b6161aa3f2f089b22&id=455862262&stream=1&ts=1412556171.0"
- "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=11a2f649b49f45b544a0491a5850ebfd&id=3860349223&stream=1&ts=1412556171.0"
- "Collision Warning (Intro)"
- "Twisted Disposition"
- "Deception"
- "Ascension"
- "Malicious Phantoms"
- "Shaken, Not Stirred"
- "Planetary Debris"
- "7777"
- "Contradiction"
- "Return From Oblivion"
- "Quicksand"
- "Chemical Combustion"
- "Masochism"
- "Embrace the Soul"
- "Scarlet Nebula"
- "Soulless"
- "Perilous Keepsake"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement