|
|
@ -8,7 +8,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
"""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
|
|
|
|
from .common import ChapterExtractor, MangaExtractor, Extractor
|
|
|
|
from .. import text, aes, exception
|
|
|
|
from .. import text, aes, exception
|
|
|
|
from ..cache import cache
|
|
|
|
from ..cache import cache
|
|
|
|
import hashlib
|
|
|
|
import hashlib
|
|
|
@ -16,21 +16,35 @@ import ast
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class KissmangaBase():
|
|
|
|
class RedirectMixin():
|
|
|
|
|
|
|
|
"""Detect and handle redirects to CAPTCHA pages"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def request(self, url):
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
|
|
|
response = Extractor.request(self, url)
|
|
|
|
|
|
|
|
if not response.history or "/AreYouHuman" not in response.url:
|
|
|
|
|
|
|
|
return response
|
|
|
|
|
|
|
|
if self.config("captcha", "stop") == "wait":
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
self.log.error(
|
|
|
|
|
|
|
|
"Redirect to \n%s\nVisit this URL in your browser and "
|
|
|
|
|
|
|
|
"solve the CAPTCHA to continue", response.url)
|
|
|
|
|
|
|
|
raise exception.StopExtraction()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class KissmangaBase(RedirectMixin):
|
|
|
|
"""Base class for kissmanga extractors"""
|
|
|
|
"""Base class for kissmanga extractors"""
|
|
|
|
category = "kissmanga"
|
|
|
|
category = "kissmanga"
|
|
|
|
archive_fmt = "{chapter_id}_{page}"
|
|
|
|
archive_fmt = "{chapter_id}_{page}"
|
|
|
|
root = "https://kissmanga.com"
|
|
|
|
root = "https://kissmanga.com"
|
|
|
|
|
|
|
|
|
|
|
|
def request(self, url):
|
|
|
|
|
|
|
|
response = super().request(url)
|
|
|
|
|
|
|
|
if response.history and "/AreYouHuman" in response.url:
|
|
|
|
|
|
|
|
self.log.error("Redirect to \n%s\n"
|
|
|
|
|
|
|
|
"Visit this URL in your browser and solve "
|
|
|
|
|
|
|
|
"the CAPTCHA to continue.", response.url)
|
|
|
|
|
|
|
|
raise exception.StopExtraction()
|
|
|
|
|
|
|
|
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def parse_chapter_string(data):
|
|
|
|
def parse_chapter_string(data):
|
|
|
|
"""Parse 'chapter_string' value contained in 'data'"""
|
|
|
|
"""Parse 'chapter_string' value contained in 'data'"""
|
|
|
|