[batoto] fix crash when manga/chapter contains a '-' (#5200)

This commit is contained in:
Mike Fährmann
2024-02-16 00:10:08 +01:00
parent 0abd9723af
commit 24c1317e0d
2 changed files with 27 additions and 2 deletions

View File

@@ -40,10 +40,18 @@ class BatotoChapterExtractor(BatotoBase, ChapterExtractor):
def metadata(self, page):
extr = text.extract_from(page)
manga, info, _ = extr("<title>", "<").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)