summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/hentai2read.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-04-15 05:25:37 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2025-04-15 05:25:37 -0400
commitb830dc03b3b7c9dd119648e1be9c1145d56e096c (patch)
treee9d03b6b4ab93990243c0038c20ada2464fa4072 /gallery_dl/extractor/hentai2read.py
parent662e5ac868a5c1a3e7bc95b37054b3a0ca4db74f (diff)
New upstream version 1.29.4.upstream/1.29.4
Diffstat (limited to 'gallery_dl/extractor/hentai2read.py')
-rw-r--r--gallery_dl/extractor/hentai2read.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/gallery_dl/extractor/hentai2read.py b/gallery_dl/extractor/hentai2read.py
index 9ab1411..1317ce9 100644
--- a/gallery_dl/extractor/hentai2read.py
+++ b/gallery_dl/extractor/hentai2read.py
@@ -25,26 +25,30 @@ class Hentai2readChapterExtractor(Hentai2readBase, ChapterExtractor):
pattern = r"(?:https?://)?(?:www\.)?hentai2read\.com(/[^/?#]+/([^/?#]+))"
example = "https://hentai2read.com/TITLE/1/"
- def __init__(self, match):
- self.chapter = match.group(2)
- ChapterExtractor.__init__(self, match)
-
def metadata(self, page):
title, pos = text.extract(page, "<title>", "</title>")
manga_id, pos = text.extract(page, 'data-mid="', '"', pos)
chapter_id, pos = text.extract(page, 'data-cid="', '"', pos)
- chapter, sep, minor = self.chapter.partition(".")
- match = re.match(r"Reading (.+) \(([^)]+)\) Hentai(?: by (.+))? - "
+ chapter, sep, minor = self.groups[1].partition(".")
+
+ match = re.match(r"Reading (.+) \(([^)]+)\) Hentai(?: by (.*))? - "
r"([^:]+): (.+) . Page 1 ", title)
+ if match:
+ manga, type, author, _, title = match.groups()
+ else:
+ self.log.warning("Failed to extract 'manga', 'type', 'author', "
+ "and 'title' metadata")
+ manga = type = author = title = ""
+
return {
- "manga": match.group(1),
+ "manga": manga,
"manga_id": text.parse_int(manga_id),
"chapter": text.parse_int(chapter),
"chapter_minor": sep + minor,
"chapter_id": text.parse_int(chapter_id),
- "type": match.group(2),
- "author": match.group(3),
- "title": match.group(5),
+ "type": type,
+ "author": author,
+ "title": title,
"lang": "en",
"language": "English",
}