change keyword names to valid Python identifiers

This commit mostly replaces all minus-signs ('-') in keyword names with
underscores ('_') to allow them to be used in filter-expressions. For
example 'gallery-id' got renamed to 'gallery_id'.

(It is theoretically possible to access any variable, regardless of its
name, with 'locals()["NAME"]', but that seems a bit too convoluted if
just 'NAME' could be enough)
This commit is contained in:
Mike Fährmann
2017-09-10 22:20:47 +02:00
parent 81877bb5f6
commit 6f30cf4c64
28 changed files with 157 additions and 154 deletions

View File

@@ -42,7 +42,7 @@ class Hentai2readChapterExtractor(hentaicdn.HentaicdnChapterExtractor):
pattern = [r"(?:https?://)?(?:www\.)?hentai2read\.com/([^/]+)/(\d+)"]
test = [("http://hentai2read.com/amazon_elixir/1/", {
"url": "964b942cf492b3a129d2fe2608abfc475bc99e71",
"keyword": "fc79e4c70d61ae476aea2b63a75324e3d96f4497",
"keyword": "a159017295546e2647d80a4a4165c702662abe1e",
})]
def __init__(self, match):
@@ -57,7 +57,7 @@ class Hentai2readChapterExtractor(hentaicdn.HentaicdnChapterExtractor):
match = re.match(r"Reading (.+) \(([^)]+)\) Hentai(?: by (.+))? - "
r"(\d+): (.+) . Page 1 ", title)
return {
"manga-id": images[0].split("/")[-3],
"manga_id": images[0].split("/")[-3],
"chapter": self.chapter,
"count": len(images),
"manga": match.group(1),