summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/exhentai.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/extractor/exhentai.py')
-rw-r--r--gallery_dl/extractor/exhentai.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/gallery_dl/extractor/exhentai.py b/gallery_dl/extractor/exhentai.py
index 1833b1a..75e19d6 100644
--- a/gallery_dl/extractor/exhentai.py
+++ b/gallery_dl/extractor/exhentai.py
@@ -121,7 +121,7 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor):
r"|/s/([\da-f]{10})/(\d+)-(\d+))")
test = (
("https://exhentai.org/g/1200119/d55c44d3d0/", {
- "keyword": "1b353fad00dff0665b1746cdd151ab5cc326df23",
+ "keyword": "3eeae7bde70dd992402d4cc0230ea0f2c4af46c5",
"content": "e9891a4c017ed0bb734cd1efba5cd03f594d31ff",
}),
("https://exhentai.org/g/960461/4f0e369d82/", {
@@ -151,9 +151,6 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor):
def items(self):
self.login()
- if self.limits:
- self._init_limits()
-
if self.gallery_token:
gpage = self._gallery_page()
self.image_token = text.extract(gpage, 'hentai.org/s/', '"')[0]
@@ -308,15 +305,8 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor):
raise exception.NotFoundError("image page")
return page
- def _init_limits(self):
- self._update_limits()
- if self._remaining <= 0:
- self.log.error("Image limit reached!")
- ExhentaiExtractor.LIMIT = True
- raise exception.StopExtraction()
-
def _check_limits(self, data):
- if data["num"] % 20 == 0:
+ if not self._remaining or data["num"] % 20 == 0:
self._update_limits()
self._remaining -= data["cost"]
@@ -360,7 +350,8 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor):
"width": text.parse_int(parts[0]),
"height": text.parse_int(parts[2]),
"size": size,
- "cost": 1 + math.ceil(size * 5 / 1024 / 1024)
+ # 1 initial point + 1 per 0.1 MB
+ "cost": 1 + math.ceil(size / 104857.6)
}