[exhentai] update image URL parsing (#1094)

pull/2278/head
Mike Fährmann 4 years ago
parent e3480bc8de
commit 9b2e5f72d6
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -347,24 +347,33 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor):
@staticmethod @staticmethod
def _parse_image_info(url): def _parse_image_info(url):
parts = url.split("/")[4].split("-") for part in url.split("/")[4:]:
try:
_, size, width, height, _ = part.split("-")
break
except ValueError:
pass
else:
size = width = height = 0
return { return {
"width": text.parse_int(parts[2]),
"height": text.parse_int(parts[3]),
"size": text.parse_int(parts[1]),
"cost" : 1, "cost" : 1,
"size" : text.parse_int(size),
"width" : text.parse_int(width),
"height": text.parse_int(height),
} }
@staticmethod @staticmethod
def _parse_original_info(info): def _parse_original_info(info):
parts = info.lstrip().split(" ") parts = info.lstrip().split(" ")
size = text.parse_bytes(parts[3] + parts[4][0]) size = text.parse_bytes(parts[3] + parts[4][0])
return { return {
# 1 initial point + 1 per 0.1 MB
"cost" : 1 + math.ceil(size / 100000),
"size" : size,
"width" : text.parse_int(parts[0]), "width" : text.parse_int(parts[0]),
"height": text.parse_int(parts[2]), "height": text.parse_int(parts[2]),
"size": size,
# 1 initial point + 1 per 0.1 MB
"cost": 1 + math.ceil(size / 100000)
} }

Loading…
Cancel
Save