diff --git a/gallery_dl/extractor/batoto.py b/gallery_dl/extractor/batoto.py index e82cd09f..2adb142a 100644 --- a/gallery_dl/extractor/batoto.py +++ b/gallery_dl/extractor/batoto.py @@ -40,10 +40,18 @@ class BatotoChapterExtractor(BatotoBase, ChapterExtractor): def metadata(self, page): extr = text.extract_from(page) - manga, info, _ = extr("", "<").rsplit(" - ", 3) + try: + manga, info, _ = extr("<title>", "<").rsplit(" - ", 3) + except ValueError: + manga = info = None + manga_id = text.extr( extr('rel="canonical" href="', '"'), "/title/", "/") + if not manga: + manga = extr('link-hover">', "<") + info = text.remove_html(extr('link-hover">', "</")) + match = re.match( r"(?:Volume\s+(\d+) )?" r"\w+\s+(\d+)(.*)", info) diff --git a/test/results/batoto.py b/test/results/batoto.py index 4992bda1..0334f2cc 100644 --- a/test/results/batoto.py +++ b/test/results/batoto.py @@ -42,6 +42,23 @@ __tests__ = ( "chapter": 5, }, +{ + "#url" : "https://mto.to/chapter/2584460", + "#comment" : "'-' in manga title (#5200)", + "#category": ("", "batoto", "chapter"), + "#class" : batoto.BatotoChapterExtractor, + + "chapter" : 9, + "chapter_id": 2584460, + "chapter_minor": "", + "count" : 18, + "date" : "dt:2023-11-26 11:01:12", + "manga" : "Isekai Teni shitara Aiken ga Saikyou ni narimashita - Silver Fenrir to Ore ga Isekai Kurashi wo Hajimetara (Official)", + "manga_id" : 126793, + "title" : "", + "volume" : 0 +}, + { "#url" : "https://bato.to/title/86408/1681030", "#category": ("", "batoto", "chapter"), @@ -85,7 +102,7 @@ __tests__ = ( "#class" : batoto.BatotoMangaExtractor, "#count" : ">= 29", - "manga": "The Grand Duke’s Fox Princess ⎝⎝MGCHAN⎠⎠", + "manga": "The Grand Duke’s Fox Princess〖MGCHAN〗", }, {