[exhentai] add ability to specify custom image limit (#940)

This commit is contained in:
Mike Fährmann
2020-08-17 22:14:56 +02:00
parent b2009ea39e
commit dbbbb21180
2 changed files with 12 additions and 1 deletions

View File

@@ -47,6 +47,12 @@ class ExhentaiExtractor(Extractor):
self.wait_min = self.config("wait-min", 3)
self.wait_max = self.config("wait-max", 6)
if isinstance(self.limits, int):
self._limit_max = self.limits
self.limits = True
else:
self._limit_max = 0
self._remaining = 0
if self.wait_max < self.wait_min:
self.wait_max = self.wait_min
@@ -331,6 +337,8 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor):
page = self.request(url, cookies=cookies).text
current, pos = text.extract(page, "<strong>", "</strong>")
maximum, pos = text.extract(page, "<strong>", "</strong>", pos)
if self._limit_max:
maximum = self._limit_max
self.log.debug("Image Limits: %s/%s", current, maximum)
self._remaining = text.parse_int(maximum) - text.parse_int(current)