Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re,os,urllib2,os.path
- for i in range(len(re.findall('a href=".*?title=".*?',urllib2.urlopen("http://www.xkcd.com/archive/").read()))):
- if not os.path.isfile(r"B:\Images\xkcd"+"\ "+str(i+1)+".png"):
- with open(r"B:\Images\xkcd"+"\ "+str(i+1)+".png",'wb+') as o:
- o.write(urllib2.urlopen("http://"+re.findall('<img.*?src="//imgs.xkcd.com/comics/.*?"',urllib2.urlopen("http://www.xkcd.com/{0}/".format(i+1)).read())[0].split("//")[1][:-1]).read())
Add Comment
Please, Sign In to add comment