Advertisement
Guest User

bandcamp leecher prototype

a guest
Oct 31st, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. # Create list file from webpage <album title, urls, titles>
  2.  
  3. #!/bin/bash
  4. curl -s http://etherealuniverse.bandcamp.com/album/ethereal-universe-vol-10 > page.html
  5. cat page.html | grep 'link rel' | grep 'album' | sed -ne 's/.*title=\"\(.*\)" href.*/albumtitle=\1/p' > list
  6. cat page.html | grep 'trackinfo :' | sed 's/.$//' | sed 's/^.*: //' | jq '.[].file[], .[].title' >> list
  7.  
  8. # Process list file with python (load album title into variable, flatten urls and titles into one list)
  9. # then call curl (url redirect enabled) to download the mp3
  10.  
  11. #!/usr/bin/env python2.7
  12. import os
  13. import sys
  14.  
  15. fd = open("list", "r");
  16.  
  17. urllist=[]
  18. titlelist=[]
  19.  
  20. for l in fd:
  21. y = l.replace('\n', '')
  22. if "http" in y:
  23. urllist.append(y)
  24. elif "albumtitle" in y:
  25. albumtitle = y.replace("albumtitle=", "")
  26. else:
  27. y = y.replace("\"", "")
  28. titlelist.append(y)
  29.  
  30. print albumtitle
  31. os.mkdir(albumtitle)
  32. for i in range(len(urllist)):
  33. title = titlelist[i]
  34. url = urllist[i]
  35. cmd = "curl -L -s " + url + " > \"" + albumtitle + "/"+ title + ".mp3\""
  36. print "Downloading %s/%s" % (albumtitle, title)
  37. os.system(cmd)
  38.  
  39. fd.close()
  40.  
  41.  
  42. Example list output:
  43.  
  44. albumtitle=Ethereal Universe: Ethereal Universe Vol 10
  45. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=9f196f095a416cec043ddb4dc73d15b8&id=4266534932&stream=1&ts=1412556171.0"
  46. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=6abb9d6f9ed3499320237831dbe80e46&id=1922216492&stream=1&ts=1412556171.0"
  47. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=73ced2d9f64d5f20c91321dd9d8b4e45&id=999226868&stream=1&ts=1412556171.0"
  48. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=c3406f2f8ad3110e2262bc7c7d88276d&id=136248659&stream=1&ts=1412556171.0"
  49. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=d6e365c2886fed8143fdcac2d735a6d5&id=1756742211&stream=1&ts=1412556171.0"
  50. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=4e7911ea3257374d4d0dbf0b21b078ad&id=2211090495&stream=1&ts=1412556171.0"
  51. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=6c072609a038767607809b28469e29ea&id=2501189368&stream=1&ts=1412556171.0"
  52. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=9ad9b17c10424e9afb8a4116435a64ba&id=977675853&stream=1&ts=1412556171.0"
  53. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=b5fce1d559b7381aa33938cf18b3e0ac&id=1937966401&stream=1&ts=1412556171.0"
  54. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=1175ca548cacb6343c39447db4043ebe&id=956569864&stream=1&ts=1412556171.0"
  55. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=72250346fc5a5540b1f43dbd370f0753&id=3273441571&stream=1&ts=1412556171.0"
  56. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=27a251a6b61326e204f16f33b3be759a&id=1481419656&stream=1&ts=1412556171.0"
  57. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=a376055a52e3fb23c97e78d0e17e9dfe&id=1002935646&stream=1&ts=1412556171.0"
  58. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=68e63371cd77812c4ccf50c7fdb3a668&id=220889560&stream=1&ts=1412556171.0"
  59. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=75718b309ff447743498ad5aefdf4676&id=3092831564&stream=1&ts=1412556171.0"
  60. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=0e38340bbedd944b6161aa3f2f089b22&id=455862262&stream=1&ts=1412556171.0"
  61. "http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=11a2f649b49f45b544a0491a5850ebfd&id=3860349223&stream=1&ts=1412556171.0"
  62. "Collision Warning (Intro)"
  63. "Twisted Disposition"
  64. "Deception"
  65. "Ascension"
  66. "Malicious Phantoms"
  67. "Shaken, Not Stirred"
  68. "Planetary Debris"
  69. "7777"
  70. "Contradiction"
  71. "Return From Oblivion"
  72. "Quicksand"
  73. "Chemical Combustion"
  74. "Masochism"
  75. "Embrace the Soul"
  76. "Scarlet Nebula"
  77. "Soulless"
  78. "Perilous Keepsake"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement