From e368c3c98a0ef701a44bad7ba1a2f20031b5f129 Mon Sep 17 00:00:00 2001 From: Glax Date: Sat, 29 Jun 2024 19:37:02 +0200 Subject: [PATCH] Fix https://github.com/C9Glax/tranga/issues/193 Mangaworld Volume and Chapter number Parsing. --- Tranga/MangaConnectors/Mangaworld.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Tranga/MangaConnectors/Mangaworld.cs b/Tranga/MangaConnectors/Mangaworld.cs index 9558a73..d5725d7 100644 --- a/Tranga/MangaConnectors/Mangaworld.cs +++ b/Tranga/MangaConnectors/Mangaworld.cs @@ -153,10 +153,13 @@ public class Mangaworld: MangaConnector { foreach (HtmlNode volNode in document.DocumentNode.SelectNodes("//div[contains(concat(' ',normalize-space(@class),' '),'volume-element')]")) { - string volume = volNode.SelectNodes("div").First(node => node.HasClass("volume")).SelectSingleNode("p").InnerText.Split(' ')[^1]; + string volume = Regex.Match(volNode.SelectNodes("div").First(node => node.HasClass("volume")).SelectSingleNode("p").InnerText, + @"[Vv]olume ([0-9]+).*").Groups[1].Value; foreach (HtmlNode chNode in volNode.SelectNodes("div").First(node => node.HasClass("volume-chapters")).SelectNodes("div")) { - string number = chNode.SelectSingleNode("a").SelectSingleNode("span").InnerText.Split(" ")[^1]; + + string number = Regex.Match(chNode.SelectSingleNode("a").SelectSingleNode("span").InnerText, + @"[Cc]apitolo ([0-9]+).*").Groups[1].Value; string url = chNode.SelectSingleNode("a").GetAttributeValue("href", ""); ret.Add(new Chapter(manga, null, volume, number, url)); }