[8muses] fix JSON unobfuscation

limit the characters that get modified,
leave non-ASCII characters alone
This commit is contained in:
Mike Fährmann
2021-04-09 01:28:20 +02:00
parent b869b3a9eb
commit dee540050f

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2019-2020 Mike Fährmann # Copyright 2019-2021 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License version 2 as
@@ -54,10 +54,17 @@ class _8musesAlbumExtractor(Extractor):
"private": False, "private": False,
}, },
}), }),
# custom sorting
("https://www.8muses.com/comics/album/Fakku-Comics/8?sort=az", { ("https://www.8muses.com/comics/album/Fakku-Comics/8?sort=az", {
"count": ">= 70", "count": ">= 70",
"keyword": {"name": r"re:^[R-Zr-z]"}, "keyword": {"name": r"re:^[R-Zr-z]"},
}), }),
# non-ASCII characters
(("https://comics.8muses.com/comics/album/Various-Authors/Chessire88"
"/From-Trainers-to-Pokmons"), {
"count": 2,
"keyword": {"name": "re:From Trainers to Pokémons"},
}),
) )
def __init__(self, match): def __init__(self, match):
@@ -125,6 +132,6 @@ class _8musesAlbumExtractor(Extractor):
@staticmethod @staticmethod
def _unobfuscate(data): def _unobfuscate(data):
return json.loads("".join([ return json.loads("".join([
chr(33 + (ord(c) + 14) % 94) if c != " " else c chr(33 + (ord(c) + 14) % 94) if "!" <= c <= "~" else c
for c in text.unescape(data.strip("\t\n\r !")) for c in text.unescape(data.strip("\t\n\r !"))
])) ]))