Skip to content

Commit

Permalink
[hentai2read] fix and update keywords
Browse files Browse the repository at this point in the history
Added the "author" keyword and changed the name of a few others to be
consistent with other manga/chapter extractors.
  • Loading branch information
mikf committed Aug 22, 2017
1 parent c457703 commit e61a3a5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
13 changes: 8 additions & 5 deletions gallery_dl/extractor/hentai2read.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": "c05d0d0bbe188926b15a43df1f8f65b8ac11c3fd",
"keyword": "fc79e4c70d61ae476aea2b63a75324e3d96f4497",
})]

def __init__(self, match):
Expand All @@ -54,13 +54,16 @@ def __init__(self, match):

def get_job_metadata(self, page, images):
title = text.extract(page, "<title>", "</title>")[0]
match = re.match(r"Reading (?:(.+) dj - )?(.+) Hentai - \d+: ", title)
match = re.match(r"Reading (.+) \(([^)]+)\) Hentai(?: by (.+))? - "
r"(\d+): (.+) . Page 1 ", title)
return {
"gallery-id": images[0].split("/")[-3],
"manga-id": images[0].split("/")[-3],
"chapter": self.chapter,
"count": len(images),
"series": match.group(1) or "",
"title": match.group(2),
"manga": match.group(1),
"type": match.group(2),
"author": match.group(3),
"title": match.group(5),
"lang": "en",
"language": "English",
}
Expand Down
7 changes: 3 additions & 4 deletions gallery_dl/extractor/hentaicdn.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
class HentaicdnChapterExtractor(Extractor):
"""Base class for extractors for a single manga chapter"""
subcategory = "chapter"
directory_fmt = ["{category}", "{gallery-id} {title}"]
filename_fmt = ("{category}_{gallery-id}_{chapter:>02}_"
directory_fmt = ["{category}", "{manga-id} {title}"]
filename_fmt = ("{category}_{manga-id}_{chapter:>02}_"
"{num:>03}.{extension}")
url = ""

Expand All @@ -27,8 +27,7 @@ def items(self):
data = self.get_job_metadata(page, images)
yield Message.Version, 1
yield Message.Directory, data
for num, part in enumerate(images, 1):
data["num"] = num
for data["num"], part in enumerate(images, 1):
url = "https://hentaicdn.com/hentai" + part
yield Message.Url, url, text.nameext_from_url(url, data)

Expand Down
8 changes: 4 additions & 4 deletions gallery_dl/extractor/hentaihere.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class HentaihereChapterExtractor(hentaicdn.HentaicdnChapterExtractor):
pattern = [r"(?:https?://)?(?:www\.)?hentaihere\.com/m/S(\d+)/(\d+)"]
test = [("https://hentaihere.com/m/S13812/1/1/", {
"url": "964b942cf492b3a129d2fe2608abfc475bc99e71",
"keyword": "e8625ccca8466a5dee089394fc29efea6d6e2950",
"keyword": "fd6e515ccf073e3b57d39c5cb472692858bddb88",
})]

def __init__(self, match):
Expand All @@ -55,11 +55,11 @@ def get_job_metadata(self, page, images):
pattern = r"Page 1 \| (.+) \(([^)]+)\) - Chapter \d+: (.+) by (.+) at "
match = re.match(pattern, title)
return {
"gallery-id": self.gid,
"title": match.group(1),
"manga-id": self.gid,
"manga": match.group(1),
"type": match.group(2),
"chapter": self.chapter,
"chapter-name": match.group(3),
"title": match.group(3),
"author": match.group(4),
"count": len(images),
"lang": "en",
Expand Down
2 changes: 1 addition & 1 deletion gallery_dl/extractor/pixiv.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class PixivRankingExtractor(PixivExtractor):
test = [
(("https://www.pixiv.net/ranking.php"
"?mode=daily&content=illust&date=20170818"), {
"url": "83a3809e52a58f39f5cf5878fa8fcd9d8df6c760",
"url": "7fdffbecfbd420b1d202fa417d79317240be30bc",
}),
("https://www.pixiv.net/ranking.php", None),
]
Expand Down

0 comments on commit e61a3a5

Please sign in to comment.