[manganelo] match more minor version separators (#3972)

This commit is contained in:
Mike Fährmann
2023-04-27 13:12:11 +02:00
parent c182094ebf
commit 215028a462

View File

@@ -16,21 +16,26 @@ BASE_PATTERN = r"(?:https?://)?((?:chap|read|www\.|m\.)?mangan(?:at|el)o\.com)"
class ManganeloBase(): class ManganeloBase():
category = "manganelo" category = "manganelo"
root = "https://chapmanganato.com" root = "https://chapmanganato.com"
_match_chapter = None
def __init__(self, match): def __init__(self, match):
domain, path = match.groups() domain, path = match.groups()
super().__init__(match, "https://" + domain + path) super().__init__(match, "https://" + domain + path)
self.session.headers['Referer'] = self.root self.session.headers['Referer'] = self.root
self._match_chapter = re.compile( if self._match_chapter is None:
r"(?:[Vv]ol\.?\s*(\d+)\s?)?" ManganeloBase._match_chapter = re.compile(
r"[Cc]hapter\s*([^:]+)" r"(?:[Vv]ol\.?\s*(\d+)\s?)?"
r"(?::\s*(.+))?").match r"[Cc]hapter\s*(\d+)([^:]*)"
r"(?::\s*(.+))?").match
def _parse_chapter(self, info, manga, author, date=None): def _parse_chapter(self, info, manga, author, date=None):
match = self._match_chapter(info) match = self._match_chapter(info)
volume, chapter, title = match.groups() if match else ("", "", info) if match:
chapter, sep, minor = chapter.partition(".") volume, chapter, minor, title = match.groups()
else:
volume = chapter = minor = ""
title = info
return { return {
"manga" : manga, "manga" : manga,
@@ -39,7 +44,7 @@ class ManganeloBase():
"title" : text.unescape(title) if title else "", "title" : text.unescape(title) if title else "",
"volume" : text.parse_int(volume), "volume" : text.parse_int(volume),
"chapter" : text.parse_int(chapter), "chapter" : text.parse_int(chapter),
"chapter_minor": sep + minor, "chapter_minor": minor,
"lang" : "en", "lang" : "en",
"language" : "English", "language" : "English",
} }
@@ -61,6 +66,10 @@ class ManganeloChapterExtractor(ManganeloBase, ChapterExtractor):
"keyword": "06e01fa9b3fc9b5b954c0d4a98f0153b40922ded", "keyword": "06e01fa9b3fc9b5b954c0d4a98f0153b40922ded",
"count": 45, "count": 45,
}), }),
("https://chapmanganato.com/manga-no991297/chapter-8", {
"keyword": {"chapter": 8, "chapter_minor": "-1"},
"count": 20,
}),
("https://readmanganato.com/manga-gn983696/chapter-23"), ("https://readmanganato.com/manga-gn983696/chapter-23"),
("https://manganelo.com/chapter/gamers/chapter_15"), ("https://manganelo.com/chapter/gamers/chapter_15"),
("https://manganelo.com/chapter/gq921227/chapter_23"), ("https://manganelo.com/chapter/gq921227/chapter_23"),