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.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/gallery_dl/extractor/exhentai.py b/gallery_dl/extractor/exhentai.py
index dccc74e..9cd7ae4 100644
--- a/gallery_dl/extractor/exhentai.py
+++ b/gallery_dl/extractor/exhentai.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright 2014-2022 Mike Fährmann
+# Copyright 2014-2023 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -21,8 +21,7 @@ class ExhentaiExtractor(Extractor):
"""Base class for exhentai extractors"""
category = "exhentai"
directory_fmt = ("{category}", "{gid} {title[:247]}")
- filename_fmt = (
- "{gid}_{num:>04}_{image_token}_{filename}.{extension}")
+ filename_fmt = "{gid}_{num:>04}_{image_token}_{filename}.{extension}"
archive_fmt = "{gid}_{num}"
cookienames = ("ipb_member_id", "ipb_pass_hash")
cookiedomain = ".exhentai.org"
@@ -56,10 +55,10 @@ class ExhentaiExtractor(Extractor):
if version != "ex":
self.session.cookies.set("nw", "1", domain=self.cookiedomain)
- def request(self, *args, **kwargs):
- response = Extractor.request(self, *args, **kwargs)
- if self._is_sadpanda(response):
- self.log.info("sadpanda.jpg")
+ def request(self, url, **kwargs):
+ response = Extractor.request(self, url, **kwargs)
+ if response.history and response.headers.get("Content-Length") == "0":
+ self.log.info("blank page")
raise exception.AuthorizationError()
return response
@@ -100,14 +99,6 @@ class ExhentaiExtractor(Extractor):
raise exception.AuthenticationError()
return {c: response.cookies[c] for c in self.cookienames}
- @staticmethod
- def _is_sadpanda(response):
- """Return True if the response object contains a sad panda"""
- return (
- response.headers.get("Content-Length") == "9615" and
- "sadpanda.jpg" in response.headers.get("Content-Disposition", "")
- )
-
class ExhentaiGalleryExtractor(ExhentaiExtractor):
"""Extractor for image galleries from exhentai.org"""