From 0be7ee31064a1aec9b67405cf26e73cb958dd425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 14 Dec 2018 16:15:06 +0100 Subject: [PATCH] [hitomi] fix image subdomains (closes #142) galleries with an ID ending in 1 need some special treatment --- gallery_dl/extractor/hitomi.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/hitomi.py b/gallery_dl/extractor/hitomi.py index 7048021eb0..c698569c06 100644 --- a/gallery_dl/extractor/hitomi.py +++ b/gallery_dl/extractor/hitomi.py @@ -26,6 +26,10 @@ class HitomiGalleryExtractor(ChapterExtractor): "url": "cb759868d090fe0e2655c3e29ebf146054322b6d", "keyword": "85e453d01ee7f137669e75a764ccdc65ca092ad2", }), + ("https://hitomi.la/galleries/1036181.html", { + # "aa" subdomain for gallery-id ending in 1 (#142) + "pattern": r"https://aa\.hitomi\.la/", + }), ("https://hitomi.la/reader/867789.html", None), ] @@ -62,8 +66,12 @@ def get_metadata(self, page, extr=text.extract): } def get_images(self, page): - subdomain = chr(97 + self.gid % 2) + "a" + # see https://ltn.hitomi.la/common.js + frontends = 2 + offset = self.gid % frontends if self.gid % 10 != 1 else 0 + subdomain = chr(97 + offset) + "a" base = "https://" + subdomain + ".hitomi.la/galleries/" + return [ (base + urlpart, None) for urlpart in text.extract_iter(