1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[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
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

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