[kissmanga] workaround for CAPTCHAs (fixes #818)

Requesting the same page again when being redirected to a CAPTCHA
lets us access that page without solving it.
This commit is contained in:
Mike Fährmann
2020-06-12 00:41:49 +02:00
parent 7daef6ee70
commit 4cf3d54718

View File

@@ -9,9 +9,10 @@
"""Extract manga-chapters and entire manga from https://kissmanga.com/""" """Extract manga-chapters and entire manga from https://kissmanga.com/"""
from .common import ChapterExtractor, MangaExtractor, Extractor from .common import ChapterExtractor, MangaExtractor, Extractor
from .. import text, aes, exception from .. import text, aes
from ..cache import cache from ..cache import cache
import hashlib import hashlib
import time
import ast import ast
import re import re
@@ -24,18 +25,7 @@ class RedirectMixin():
response = Extractor.request(self, url, **kwargs) response = Extractor.request(self, url, **kwargs)
if not response.history or "/AreYouHuman" not in response.url: if not response.history or "/AreYouHuman" not in response.url:
return response return response
if self.config("captcha", "stop") == "wait": time.sleep(2)
self.log.warning(
"Redirect to \n%s\nVisit this URL in your browser, solve "
"the CAPTCHA, and press ENTER to continue", response.url)
try:
input()
except (EOFError, OSError):
pass
else:
raise exception.StopExtraction(
"Redirect to \n%s\nVisit this URL in your browser and "
"solve the CAPTCHA to continue", response.url)
class KissmangaBase(RedirectMixin): class KissmangaBase(RedirectMixin):