[exhentai] update image URL parsing (#1094)
This commit is contained in:
@@ -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]),
|
"cost" : 1,
|
||||||
"height": text.parse_int(parts[3]),
|
"size" : text.parse_int(size),
|
||||||
"size": text.parse_int(parts[1]),
|
"width" : text.parse_int(width),
|
||||||
"cost": 1,
|
"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 {
|
||||||
"width": text.parse_int(parts[0]),
|
|
||||||
"height": text.parse_int(parts[2]),
|
|
||||||
"size": size,
|
|
||||||
# 1 initial point + 1 per 0.1 MB
|
# 1 initial point + 1 per 0.1 MB
|
||||||
"cost": 1 + math.ceil(size / 100000)
|
"cost" : 1 + math.ceil(size / 100000),
|
||||||
|
"size" : size,
|
||||||
|
"width" : text.parse_int(parts[0]),
|
||||||
|
"height": text.parse_int(parts[2]),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user