Advertisement
Peaser

imgur ripper

Apr 27th, 2015
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. import urllib, os, re
  2. def main():
  3.     suffix = raw_input("http://imgur.com/a/")
  4.     url = "http://imgur.com/a/"+suffix
  5.     directory = suffix+"-DL"
  6.     if not os.path.exists(directory): os.mkdir(directory)
  7.     files = re.findall('<a href="\/\/i\.imgur\.com\/(.+)" target="_blank">View full resolution<\/a>', urllib.urlopen(url).read())
  8.     for file in files:
  9.         print "Downloading %s" % file
  10.         fileurl = "http://i.imgur.com/%s" % file
  11.         urllib.urlretrieve(fileurl, directory+"/%s " % file)
  12. if __name__ == '__main__':
  13.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement