#!/usr/bin/python # -*- encode: ascii -*- # """Downloader for MANGAKAN.""" import re import os import sys wget = ["wget", "--random-wait", "-nv", "-nc", "--header=Accept-Encoding: gzip, compres, bzip, bzip2, deflate", "--header=Accept-Language: ja; q=1.0, en;q=0.5", "-U", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", "-w", "6"] if len(sys.argv) != 2: sys.exit("usage: %s %s", sys.argv[0], "uri") else: uri = sys.argv[1] found = re.search(r"(.*)/(\d+)_\w*\.html", uri) if found: parent = found.group(1) max = int(found.group(2)) images = [] for i in range(max+1): images.append("%s/image/%02d_%02x.jpg" % (parent, i, i)) #images.append("%s/sam/%02d_%02x.jpg" % (parent, i, i)) os.spawnvp(os.P_WAIT, "wget", wget+images+["--referer="+parent])