from .common import BasicExtractor from ..util import unescape, safe_request import time import random import json class Extractor(BasicExtractor): api_url = "http://exhentai.org/api.php" name_fmt = "{}_{:>04}_{}_{}" def __init__(self, match, config): BasicExtractor.__init__(self, config) self.url = match.group(0) self.gid, self.token = match.group(1).split("/") self.category = "exhentai" self.directory = self.gid self.session.cookies.update(config["exhentai-cookies"]) def images(self): e = self.extract # get gallery page text = self.request(self.url).text # get first image page url, pos = self.extract_all(text, "http://exhentai.org/s/", "-1") text = self.request(url).text # extract information _ , pos = e(text, '