[jaiminisbox] update decoding procedure (fixes #702)

This commit is contained in:
Mike Fährmann
2020-04-23 20:16:04 +02:00
parent 8fe858eb0e
commit 400a0df661

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2019 Mike Fährmann
# Copyright 2016-2020 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
@@ -19,6 +19,7 @@ from .common import (
from .. import text, util
import base64
import json
import re
class FoolslideBase(SharedConfigMixin):
@@ -85,7 +86,12 @@ class FoolslideChapterExtractor(FoolslideBase, ChapterExtractor):
data = None
if self.decode == "base64":
base64_data = text.extract(page, 'atob("', '"')[0]
pos = page.find("'fromCharCode'")
if pos >= 0:
blob = text.extract(page, "'", "'", pos+15)[0]
base64_data = re.sub(r"[a-zA-Z]", _decode_jaiminisbox, blob)
else:
base64_data = text.extract(page, 'atob("', '"')[0]
if base64_data:
data = base64.b64decode(base64_data.encode()).decode()
elif self.decode == "double":
@@ -120,6 +126,16 @@ class FoolslideMangaExtractor(FoolslideBase, MangaExtractor):
})))
def _decode_jaiminisbox(match):
c = match.group(0)
# ord("Z") == 90, ord("z") == 122
N = 90 if c <= "Z" else 122
C = ord(c) + 13
return chr(C if N >= C else (C - 26))
EXTRACTORS = {
"dokireader": {
"root": "https://kobato.hologfx.com/reader",