diff options
Diffstat (limited to 'gallery_dl/extractor/shimmie2.py')
| -rw-r--r-- | gallery_dl/extractor/shimmie2.py | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/gallery_dl/extractor/shimmie2.py b/gallery_dl/extractor/shimmie2.py index 8a08fab..67f38c4 100644 --- a/gallery_dl/extractor/shimmie2.py +++ b/gallery_dl/extractor/shimmie2.py @@ -19,17 +19,12 @@ class Shimmie2Extractor(BaseExtractor): archive_fmt = "{id}" def _init(self): - try: - instance = INSTANCES[self.category] - except KeyError: - return - - cookies = instance.get("cookies") + cookies = self.config_instance("cookies") if cookies: domain = self.root.rpartition("/")[2] self.cookies_update_dict(cookies, domain=domain) - file_url = instance.get("file_url") + file_url = self.config_instance("file_url") if file_url: self.file_url_fmt = file_url @@ -73,15 +68,15 @@ class Shimmie2Extractor(BaseExtractor): return "'" -INSTANCES = { +BASE_PATTERN = Shimmie2Extractor.update({ "loudbooru": { "root": "https://loudbooru.com", "pattern": r"loudbooru\.com", "cookies": {"ui-tnc-agreed": "true"}, }, "giantessbooru": { - "root": "https://giantessbooru.com", - "pattern": r"giantessbooru\.com", + "root": "https://sizechangebooru.com", + "pattern": r"(?:sizechange|giantess)booru\.com", "cookies": {"agreed": "true"}, }, "tentaclerape": { @@ -97,9 +92,7 @@ INSTANCES = { "root": "https://rule34hentai.net", "pattern": r"rule34hentai\.net", }, -} - -BASE_PATTERN = Shimmie2Extractor.update(INSTANCES) + r"/(?:index\.php\?q=/?)?" +}) + r"/(?:index\.php\?q=/?)?" class Shimmie2TagExtractor(Shimmie2Extractor): @@ -183,25 +176,25 @@ class Shimmie2TagExtractor(Shimmie2Extractor): extr = text.extract_from(self.request(url).text) while True: - pid = extr('href="./index.php?q=/post/view/', '&') + pid = extr("href='./index.php?q=/post/view/", "&") if not pid: break - tags, dimensions, size = extr('title="', '"').split(" // ") + tags, dimensions, size = extr("title='", "'").split(" // ") width, _, height = dimensions.partition("x") yield { "file_url": file_url_fmt(pid), - "id": pid, - "md5": "", - "tags": tags, - "width": width, - "height": height, - "size": text.parse_bytes(size[:-1]), + "id" : pid, + "md5" : "", + "tags" : tags, + "width" : width, + "height" : height, + "size" : text.parse_bytes(size[:-1]), } pnum += 1 - if not extr('/{}">{}<'.format(pnum, pnum), ">"): + if not extr("/{0}'>{0}<".format(pnum), ">"): return @@ -248,7 +241,7 @@ class Shimmie2PostExtractor(Shimmie2Extractor): "id" : self.post_id, "tags" : extr(": ", "<").partition(" - ")[0].rstrip(")"), "md5" : "", - "file_url": self.root + extr('id="main_image" src=".', '"'), + "file_url": self.root + extr("id='main_image' src='.", "'"), "width" : extr("orig_width =", ";"), "height" : 0, "size" : 0, |
