Skip to content

Commit

Permalink
[hitomi] apply format check for every image (#3030) (#3280)
Browse files Browse the repository at this point in the history
  • Loading branch information
styler00dollar authored Nov 27, 2022
1 parent a7c7953 commit a6305d0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions gallery_dl/extractor/hitomi.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,17 @@ def images(self, _):

fmt = self.config("format") or "webp"
if fmt == "original":
subdomain, fmt, ext, check = "b", "images", None, False
subdomain, path, ext, check = "b", "images", None, False
else:
subdomain, ext, check = "a", fmt, True
subdomain, path, ext, check = "a", fmt, fmt, (fmt != "webp")

result = []
for image in self.info["files"]:
if check:
if not image.get("has" + fmt):
fmt = ext = "webp"
check = False
if image.get("has" + fmt):
path = ext = fmt
else:
path = ext = "webp"
ihash = image["hash"]
idata = text.nameext_from_url(image["name"])
if ext:
Expand All @@ -134,7 +135,7 @@ def images(self, _):
inum = int(ihash[-1] + ihash[-3:-1], 16)
url = "https://{}{}.hitomi.la/{}/{}/{}/{}.{}".format(
chr(97 + gg_m.get(inum, gg_default)),
subdomain, fmt, gg_b, inum, ihash, idata["extension"],
subdomain, path, gg_b, inum, ihash, idata["extension"],
)
result.append((url, idata))
return result
Expand Down

0 comments on commit a6305d0

Please sign in to comment.