[readcomiconline] fix chapter extractor (#6070, #6335)

This commit is contained in:
Mike Fährmann
2024-12-02 21:07:11 +01:00
parent 63e042dec7
commit 26163db69d

View File

@@ -79,13 +79,22 @@ class ReadcomiconlineIssueExtractor(ReadcomiconlineBase, ChapterExtractor):
def images(self, page): def images(self, page):
results = [] results = []
referer = {"_http_headers": {"Referer": self.gallery_url}}
root = text.extr(page, "return baeu(l, '", "'")
replacements = re.findall(
r"l = l\.replace\(/([^/]+)/g, [\"']([^\"']*)", page)
for block in page.split(" pth = '")[1:]: for block in page.split(" pth = '")[1:]:
pth = text.extr(block, "", "'") pth = text.extr(block, "", "'")
for needle, repl in re.findall( for needle, repl in re.findall(
r"pth = pth\.replace\(/([^/]+)/g, [\"']([^\"']*)", block): r"pth = pth\.replace\(/([^/]+)/g, [\"']([^\"']*)", block):
pth = pth.replace(needle, repl) pth = pth.replace(needle, repl)
results.append((beau(pth), None)) for needle, repl in replacements:
pth = pth.replace(needle, repl)
results.append((baeu(pth, root), referer))
return results return results
@@ -119,20 +128,24 @@ class ReadcomiconlineComicExtractor(ReadcomiconlineBase, MangaExtractor):
return results return results
def beau(url): def baeu(url, root="", root_blogspot="https://2.bp.blogspot.com"):
"""https://readcomiconline.li/Scripts/rguard.min.js?v=1.5.1""" """https://readcomiconline.li/Scripts/rguard.min.js"""
if not root:
root = root_blogspot
url = url.replace("pw_.g28x", "b") url = url.replace("pw_.g28x", "b")
url = url.replace("d2pr.x_27", "h") url = url.replace("d2pr.x_27", "h")
if url.startswith("https"): if url.startswith("https"):
return url return url.replace(root_blogspot, root, 1)
url, sep, rest = url.partition("?") path, sep, query = url.partition("?")
containsS0 = "=s0" in url
url = url[:-3 if containsS0 else -6] contains_s0 = "=s0" in path
url = url[15:33] + url[50:] path = path[:-3 if contains_s0 else -6]
url = url[0:-11] + url[-2:] path = path[15:33] + path[50:] # step1()
url = binascii.a2b_base64(url).decode() path = path[0:-11] + path[-2:] # step2()
url = url[0:13] + url[17:] path = binascii.a2b_base64(path).decode() # atob()
url = url[0:-2] + ("=s0" if containsS0 else "=s1600") path = path[0:13] + path[17:]
return "https://2.bp.blogspot.com/" + url + sep + rest path = path[0:-2] + ("=s0" if contains_s0 else "=s1600")
return root + "/" + path + sep + query