Advertisement
Peaser

/sci/ chr dl

Feb 16th, 2015
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. import urllib, urllib2, os
  2.  
  3. baseUrl = "https://boards.4chan.org/js/jsMath/fonts/cmmi10/alpha/120/char{0}.png"
  4.  
  5. directory = os.getcwd()+"/characters/"
  6.  
  7. os.mkdir(directory)
  8.  
  9. for i in range(100):
  10.     try:
  11.         fullLink = baseUrl.format(i)
  12.         readableData = urllib2.urlopen(fullLink).read()
  13.  
  14.         if "4chan - 404 Not Found" in readableData:
  15.             raise Exception, "Not found"
  16.  
  17.         urllib.urlretrieve(fullLink, directory+"char{0}.png".format(i))
  18.  
  19.         print "Downloaded character {0}".format(i)
  20.        
  21.     except Exception, e:
  22.         print "Unable to Download character {0}, {1}".format(i, e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement