diff --git a/Tranga/MangaConnectors/Manganato.cs b/Tranga/MangaConnectors/Manganato.cs index ed478b6..c8a9479 100644 --- a/Tranga/MangaConnectors/Manganato.cs +++ b/Tranga/MangaConnectors/Manganato.cs @@ -142,7 +142,12 @@ public class Manganato : MangaConnector return Array.Empty(); List chapters = ParseChaptersFromHtml(manga, requestResult.htmlDocument); Log($"Got {chapters.Count} chapters. {manga}"); - return chapters.OrderBy(chapter => Convert.ToSingle(chapter.chapterNumber, numberFormatDecimalPoint)).ToArray(); + return chapters.OrderBy(chapter => + { + if (float.TryParse(chapter.chapterNumber, numberFormatDecimalPoint, out float chapterNumber)) + return chapterNumber; + else return 0; + }).ToArray(); } private List ParseChaptersFromHtml(Manga manga, HtmlDocument document) @@ -160,7 +165,7 @@ public class Manganato : MangaConnector string fullString = chapterInfo.Descendants("a").First(d => d.HasClass("chapter-name")).InnerText; string? volumeNumber = volRex.IsMatch(fullString) ? volRex.Match(fullString).Groups[1].Value : null; - string chapterNumber = chapterRex.Match(fullString).Groups[1].Value; + string chapterNumber = chapterRex.IsMatch(fullString) ? chapterRex.Match(fullString).Groups[1].Value : fullString; string chapterName = nameRex.Match(fullString).Groups[3].Value; string url = chapterInfo.Descendants("a").First(d => d.HasClass("chapter-name")) .GetAttributeValue("href", "");