From 98d187d1332b539e46b80d84fdf75e9d369db59f Mon Sep 17 00:00:00 2001 From: glax Date: Wed, 25 Oct 2023 18:16:26 +0200 Subject: [PATCH] Possible fix #72 Volume Numbers broke Regex Now can also parse volume numbers! --- Tranga/MangaConnectors/Bato.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Tranga/MangaConnectors/Bato.cs b/Tranga/MangaConnectors/Bato.cs index 4ebe67a..97d85ef 100644 --- a/Tranga/MangaConnectors/Bato.cs +++ b/Tranga/MangaConnectors/Bato.cs @@ -139,15 +139,16 @@ public class Bato : MangaConnector HtmlNode chapterList = result.htmlDocument.DocumentNode.SelectSingleNode("/html/body/div/main/div[3]/astro-island/div/div[2]/div/div/astro-slot"); - Regex chapterNumberRex = new(@"\/title\/.+\/[0-9]+-ch_([0-9\.]+)"); + Regex numberRex = new(@"\/title\/.+\/[0-9]+(-vol_([0-9]+))?-ch_([0-9\.]+)"); foreach (HtmlNode chapterInfo in chapterList.SelectNodes("div")) { HtmlNode infoNode = chapterInfo.FirstChild.FirstChild; string chapterUrl = infoNode.GetAttributeValue("href", ""); - string? volumeNumber = null; - string chapterNumber = chapterNumberRex.Match(chapterUrl).Groups[1].Value; + Match match = numberRex.Match(chapterUrl); + string? volumeNumber = match.Groups[2].Success ? match.Groups[2].Value : null; + string chapterNumber = match.Groups[3].Value; string chapterName = chapterNumber; string url = $"https://bato.to{chapterUrl}?load=2"; ret.Add(new Chapter(manga, chapterName, volumeNumber, chapterNumber, url));