[exhentai] move 509 check into its own function

pull/2967/head
Mike Fährmann 2 years ago
parent 7a799df17f
commit 551fdf7ad7
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -328,13 +328,7 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor):
data["image_token"] = self.key["start"] = extr('var startkey="', '";')
self.key["show"] = extr('var showkey="', '";')
# full 509.gif URLs
# - https://exhentai.org/img/509.gif
# - https://ehgt.org/g/509.gif
if iurl.endswith(("hentai.org/img/509.gif",
"ehgt.org/g/509.gif")):
self._report_limits(data)
self._check_509(iurl, data)
return url, text.nameext_from_url(iurl, data)
def images_from_api(self):
@ -370,9 +364,7 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor):
data["num"] = request["page"]
data["image_token"] = imgkey
if imgurl.endswith(("hentai.org/img/509.gif",
"ehgt.org/g/509.gif")):
self._report_limits(data)
self._check_509(imgurl, data)
yield url, text.nameext_from_url(imgurl, data)
request["imgkey"] = nextkey
@ -391,6 +383,15 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor):
if self._remaining <= 0:
self._report_limits(data)
def _check_509(self, url, data):
# full 509.gif URLs
# - https://exhentai.org/img/509.gif
# - https://ehgt.org/g/509.gif
if url.endswith(("hentai.org/img/509.gif",
"ehgt.org/g/509.gif")):
self.log.debug(url)
self._report_limits(data)
def _update_limits(self):
url = "https://e-hentai.org/home.php"
cookies = {

Loading…
Cancel
Save