[kissmanga] fix edge-case

pull/17/head
Mike Fährmann 7 years ago
parent ffd72424bf
commit e41efbd2d9
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -118,35 +118,32 @@ class KissmangaChapterExtractor(KissmangaExtractor):
return []
def build_aes_key(self, page):
chko = ""
chko = self._chko_from_external_script()
for script in self._scripts(page):
for part in [p.strip() for p in script.split(";")]:
for stmt in [s.strip() for s in script.split(";")]:
if part.startswith("var _"):
name, _, value = part[4:].partition(" = ")
if stmt.startswith("var _"):
name, _, value = stmt[4:].partition(" = ")
name += "[0]"
value = ast.literal_eval(value)[0]
elif part.startswith("chko = "):
part = part[7:]
if part == name:
elif stmt.startswith("chko = "):
stmt = stmt[7:]
if stmt == name:
chko = value
elif part == "chko + " + name:
if not chko:
chko = self._chko_from_external_script()
elif stmt == "chko + " + name:
chko = chko + value
elif part == name + " + chko":
if not chko:
chko = self._chko_from_external_script()
elif stmt == name + " + chko":
chko = value + chko
else:
self.log.warning("unrecognized expression: '%s'", part)
self.log.warning("unrecognized expression: '%s'", stmt)
elif part.startswith("key = "):
elif stmt.startswith("key = "):
pass
else:
self.log.warning("unrecognized statement: '%s'", part)
self.log.warning("unrecognized statement: '%s'", stmt)
return list(hashlib.sha256(chko.encode("ascii")).digest())

@ -56,8 +56,8 @@ class PawooAccountExtractor(PawooExtractor):
pattern = [r"(?:https?://)?pawoo\.net/(@[^/]+)/?$"]
test = [
("https://pawoo.net/@kuroda", {
"url": "1507de8fe69a35d9ceb837c7082e25425eeed593",
"keyword": "ece8ba650f6f1519949bc94fd06c37721fc2f65e",
"url": "a3f9e7555f2b024554c0e9b6cbcc7991af13cf99",
"keyword": "9ef830113658fa15ed0b931bc3c650c417613162",
}),
("https://pawoo.net/@zZzZz/", {
"exception": exception.NotFoundError,
@ -84,8 +84,8 @@ class PawooStatusExtractor(PawooExtractor):
pattern = [r"(?:https?://)?pawoo\.net/@[^/]+/(\d+)"]
test = [
("https://pawoo.net/@takehana_note/559043", {
"url": "bff6f435c0101a911eebd985d6b752c2b61721ef",
"keyword": "752615b20fb9490f18da69ce3822343e03ec61ff",
"url": "f95cc8c0274c4143e7e21dbdc693b90c65b596e3",
"keyword": "4fa98754e1bee4be244fd72d01a1cefdc12f9fbb",
"content": "3b148cf90174173355fe34179741ce476921b2fc",
}),
("https://pawoo.net/@zZzZz/12346", {

@ -25,6 +25,6 @@ class YonkouprodMangaExtractor(foolslide.FoolslideMangaExtractor):
"""Extractor for manga from yonkouprod.com"""
category = "yonkouprod"
pattern = foolslide.manga_pattern(r"(?:www\.)?yonkouprod\.com/reader")
test = [("https://yonkouprod.com/reader/series/attack-on-titan/", {
"url": "33bc7a08a6fbf41cf609bdd000d16893d55a3f29",
test = [("https://yonkouprod.com/reader/series/one-punch-man/", {
"url": "e17ed7a2098e2f18e50b64a28a810f62687d05e2",
})]

Loading…
Cancel
Save