#This is xah's crappy code for extracting images off ac.qq.com #You'll need to download the requests. Written for png image extraction. import requests, re, os, base64 from PIL import Image def base64ToString(b): return base64.b64decode(b).decode('utf-8') def name(loop): loop = int(loop) + 1 if loop < 10: loop = '00' + str(loop) elif loop < 100: loop = '0' + str(loop) else: loop = str(loop) return str(loop) prefix = input('Please input a prefix: ') folder = input('Please input a folder name: ') url = input('Please input the url of the ac.qq.com chapter: ') res = requests.get(url) soup = res.text codesearcher = re.compile(r"var DATA = '(.*?)',") c = codesearcher.search(str(soup)) code = base64ToString(c.group(1)[1:]) picsearcher = re.compile(r'"url":"(.*?)"}') p = picsearcher.findall(code) pageNum = '001' os.makedirs(folder, exist_ok=True) for i in p: regex = re.compile(r'\\') other = regex.sub('', i) if other.startswith('http://comic.qq.com/'): break print('Downloading page %s...' % other) fileName = os.path.join(folder, prefix + pageNum + '.png') imageFile = open(fileName, 'wb') imageFile.write(requests.get(other, stream=True).content) imageFile.close() img = Image.open(fileName) img.save(fileName, 'png') pageNum = name(pageNum) print('Done')