Advertisement
Guest User

CODE

a guest
Sep 26th, 2012
1,688
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. import mechanize
  2. import urllib, urllib2, re
  3. from bs4 import BeautifulSoup
  4. ####MECHANIZE####
  5. br = mechanize.Browser()
  6. res = br.open("http://www.emuparadise.me/soundtracks/highquality/Metal_Gear_20th_Anniversary/72")
  7. a = 2 #COUNTER FOR LOOP
  8. br.follow_link(text_regex='Download', nr=a)
  9. b = br.geturl() #GETS THE URL
  10. print b
  11.  
  12.  
  13. page = urllib2.urlopen(b).read()
  14. soup = BeautifulSoup(page)
  15. soup.prettify()
  16. t = soup.find_all(href=re.compile(".flac$"))
  17. print t
  18.  
  19. f = open("/home/rishub/Desktop/mggfs.flac", "w")
  20. print "getting file"
  21. f.write(urllib2.urlopen("http://50.7.161.234/bks/94/245/Music/[029] MG 20th Anniversary [FLAC]/01 Metal Gear 20 Years History -Past, Present, Future-.flac").read())
  22. print "dpne"
  23. f.close
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement