1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[hentainexus] fix extraction (fixes #1125)

This commit is contained in:
Mike Fährmann 2020-11-20 22:31:35 +01:00
parent ca59bd691c
commit 174945d2b2
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -10,6 +10,7 @@
from .common import GalleryExtractor, Extractor, Message
from .. import text, util
import binascii
import json
@ -57,10 +58,26 @@ class HentainexusGalleryExtractor(GalleryExtractor):
return data
def images(self, _):
url = "{}/read/{}".format(self.root, self.gallery_id)
url = "{}/read/{}/001".format(self.root, self.gallery_id)
page = self.request(url).text
urls = text.extract(page, "initReader(", "]")[0] + "]"
return [(url, None) for url in json.loads(urls)]
data = json.loads(self._decode(text.extract(
page, 'initReader("', '"')[0]))
base = data["b"] + data["r"]
gid = data["i"]
return [
("{}{}/{}/{}".format(base, page["h"], gid, page["p"]), None)
for page in data["f"]
]
@staticmethod
def _decode(data):
blob = binascii.a2b_base64(data)
return "".join(
chr(blob[i] ^ blob[i-64])
for i in range(64, len(blob))
)
@staticmethod
def _join_title(data):