[readcomiconline] unobfuscate image URLs (#2481)

This commit is contained in:
Mike Fährmann 2022-04-15 15:58:22 +02:00
parent a6c4ff58fb
commit 60ad46ddcc
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2021 Mike Fährmann
# Copyright 2016-2022 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
@ -10,6 +10,7 @@
from .common import Extractor, ChapterExtractor, MangaExtractor
from .. import text, exception
import binascii
import re
BASE_PATTERN = r"(?i)(?:https?://)?(?:www\.)?readcomiconline\.(?:li|to)"
@ -22,6 +23,7 @@ class ReadcomiconlineBase():
filename_fmt = "{comic}_{issue:>03}_{page:>03}.{extension}"
archive_fmt = "{issue_id}_{page}"
root = "https://readcomiconline.li"
browser = "firefox"
def request(self, url, **kwargs):
"""Detect and handle redirects to CAPTCHA pages"""
@ -54,7 +56,7 @@ class ReadcomiconlineIssueExtractor(ReadcomiconlineBase, ChapterExtractor):
def __init__(self, match):
ChapterExtractor.__init__(self, match)
self.gallery_url += "&quality=hq"
self.gallery_url += "&quality=" + self.config("quality", "hq")
self.issue_id = match.group(2)
def metadata(self, page):
@ -71,7 +73,7 @@ class ReadcomiconlineIssueExtractor(ReadcomiconlineBase, ChapterExtractor):
def images(self, page):
return [
(url, None)
(beau(url), None)
for url in text.extract_iter(
page, 'lstImages.push("', '"'
)
@ -114,3 +116,18 @@ class ReadcomiconlineComicExtractor(ReadcomiconlineBase, MangaExtractor):
"lang": "en", "language": "English",
}))
return results
def beau(url):
"""https://readcomiconline.li/Scripts/rguard.min.js?v=1.1"""
if url.startswith("https"):
return url
containsS0 = "=s0" in url
url = url[:-3 if containsS0 else -6]
url = url[4:22] + url[25:]
url = url[0:-6] + url[-2:]
url = binascii.a2b_base64(url).decode()
url = url[0:13] + url[17:]
url = url[0:-2] + ("=s0" if containsS0 else "=s1600")
return "https://2.bp.blogspot.com/" + url