Skip to content

Commit

Permalink
[hitomi] fix image subdomains (closes #142)
Browse files Browse the repository at this point in the history
galleries with an ID ending in 1 need some special treatment
  • Loading branch information
mikf committed Dec 14, 2018
1 parent fe96835 commit 0be7ee3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gallery_dl/extractor/hitomi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 0be7ee3

Please sign in to comment.