Closed Nippey closed 6 years ago
Hi, nevermind!
I fetched the URL with WGET to check what text.unescape(data["title"])
was trying to parse:
This gallery has been flagged as Offensive For Everyone
So, I follwed the recommended procedure and created a user account .. working now!
I will not close this right away, as I have a proposal:
If this kind of banner comes up, I am still able to contine by clicking "View Gallery". Maybe this can be integrated into the extractor.
Original Link: https://e-hentai.org/g/1266008/eedea8501f/ View Link (One session): https://e-hentai.org/g/1266008/eedea8501f/?nw=session View Link (Always): https://e-hentai.org/g/1266008/eedea8501f/?nw=always
Regards! Nippey
Thanks for reporting this and "investigating" a bit ... makes writing a solution a lot easier.
If I do a proposal for free software, I might as well provide some ideas in code ;)
Basically, I think about two methods. A: Warn the user to use credentials (not tested) B: Try again by skipping the warning (tested, working for me!)
You can find both below.
@staticmethod
def _is_offensive(response):
"""Return True if the response object contains a 'fallges as offensive' warning"""
return (
"Content Warning" in response.text
)
"""Option A: Just Warn about it"""
class OffensiveError(ExtractionError):
"""Gallery is flagged offensive and should be donwloaded with login credentials"""
def request(self, *args, **kwargs):
response = Extractor.request(self, *args, **kwargs)
if self._is_sadpanda(response):
self.log.info("sadpanda.jpg")
raise exception.AuthorizationError()
if self._is_offensive(response):
self.log.info("Offensive Gallery: Please provice credentials to continue")
raise exception.OffensiveError()
return response
"""Option B: Try to skip it"""
def request(self, *args, **kwargs):
response = Extractor.request(self, *args, **kwargs)
if self._is_sadpanda(response):
self.log.info("sadpanda.jpg")
raise exception.AuthorizationError()
if self._is_offensive(response):
self.log.info("Offensive Gallery: Skipping Warning")
## Add request flag "?nw=always" to <url> parameter
args = list(args)
args[0] = args[0] + "?nw=always"
args = tuple(args)
## Is it okay this way??
response = Extractor.request(self, *args, **kwargs)
return response
Already solved, that was fast o.o Thanks!!
Hi, I got an error while downloading from e-hentai. Previous downloads of other galleries succeeded. Below is the verbose output as requested by the error message
Regards! Nippey