Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Rename to Bartkira.py
- # python Bartkira.py
- # Wait ...
- import urllib2
- import time
- images = []
- base_url = "http://www.bartkira.com/uploads/"
- source = urllib2.urlopen("http://www.bartkira.com/volume-1.html")
- for line in source.readlines():
- if "wSlideshow.render" in line:
- loc = -1
- while True:
- loc = line.find("1/0", loc + 1)
- if loc != -1:
- end = line.find(".", loc) + 4
- image_url = base_url + line[loc:end].replace(".", "_orig.")
- images.append(image_url)
- else:
- break
- index = 0
- for image in images:
- print image
- image_type = ".jpg"
- if ".jpg" in image:
- image_type = ".jpg"
- if ".png" in image:
- image_type = ".png"
- imagefile = urllib2.urlopen(image)
- page_name = "Bartkira_" + str(index+1).zfill(3) + image_type
- output = open(page_name,'wb')
- output.write(imagefile.read())
- output.close()
- time.sleep(1)
- index += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement