From 8cee11aa22bcfd72f8570e4589fcfa57ad5b3abb Mon Sep 17 00:00:00 2001 From: Glax Date: Tue, 29 Oct 2024 19:15:19 +0100 Subject: [PATCH] Fix #272 Manhuaplus missing year string --- Tranga/MangaConnectors/ManhuaPlus.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Tranga/MangaConnectors/ManhuaPlus.cs b/Tranga/MangaConnectors/ManhuaPlus.cs index 98bc368..d66fede 100644 --- a/Tranga/MangaConnectors/ManhuaPlus.cs +++ b/Tranga/MangaConnectors/ManhuaPlus.cs @@ -108,9 +108,10 @@ public class ManhuaPlus : MangaConnector Log("No genres found"); } - string yearNodeStr = document.DocumentNode - .SelectSingleNode("//aside//i[contains(concat(' ',normalize-space(@class),' '),' fa-clock ')]/../span").InnerText.Replace("\n", ""); - int year = int.Parse(yearNodeStr.Split(' ')[0].Split('/')[^1]); + Regex yearRex = new(@"(?:[0-9]{1,2}\/){2}([0-9]{2,4}) [0-9]{1,2}:[0-9]{1,2}"); + HtmlNode yearNode = document.DocumentNode.SelectSingleNode("//aside//i[contains(concat(' ',normalize-space(@class),' '),' fa-clock ')]/../span"); + Match match = yearRex.Match(yearNode.InnerText); + int year = match.Success && match.Groups[1].Success ? int.Parse(match.Groups[1].Value) : 1960; status = document.DocumentNode.SelectSingleNode("//aside//i[contains(concat(' ',normalize-space(@class),' '),' fa-rss ')]/../span").InnerText.Replace("\n", ""); switch (status.ToLower())