From 35f2625f0577c76a33bf70f32b42a692a419d623 Mon Sep 17 00:00:00 2001 From: Glax Date: Mon, 16 Sep 2024 19:52:25 +0200 Subject: [PATCH] Fix #249 Manhuaplus where author/tags are not set. --- Tranga/MangaConnectors/ManhuaPlus.cs | 32 ++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/Tranga/MangaConnectors/ManhuaPlus.cs b/Tranga/MangaConnectors/ManhuaPlus.cs index 524c267..9335388 100644 --- a/Tranga/MangaConnectors/ManhuaPlus.cs +++ b/Tranga/MangaConnectors/ManhuaPlus.cs @@ -82,17 +82,31 @@ public class ManhuaPlus : MangaConnector HtmlNode titleNode = document.DocumentNode.SelectSingleNode("//h1"); string sortName = titleNode.InnerText.Replace("\n", ""); - HtmlNode[] authorsNodes = document.DocumentNode - .SelectNodes("//a[contains(@href, 'https://manhuaplus.org/authors/')]") - .ToArray(); List authors = new(); - foreach (HtmlNode authorNode in authorsNodes) - authors.Add(authorNode.InnerText); + try + { + HtmlNode[] authorsNodes = document.DocumentNode + .SelectNodes("//a[contains(@href, 'https://manhuaplus.org/authors/')]") + .ToArray(); + foreach (HtmlNode authorNode in authorsNodes) + authors.Add(authorNode.InnerText); + } + catch (ArgumentNullException e) + { + Log("No authors found."); + } - HtmlNode[] genreNodes = document.DocumentNode - .SelectNodes("//a[contains(@href, 'https://manhuaplus.org/genres/')]").ToArray(); - foreach (HtmlNode genreNode in genreNodes) - tags.Add(genreNode.InnerText.Replace("\n", "")); + try + { + HtmlNode[] genreNodes = document.DocumentNode + .SelectNodes("//a[contains(@href, 'https://manhuaplus.org/genres/')]").ToArray(); + foreach (HtmlNode genreNode in genreNodes) + tags.Add(genreNode.InnerText.Replace("\n", "")); + } + catch (ArgumentNullException e) + { + Log("No genres found"); + } string yearNodeStr = document.DocumentNode .SelectSingleNode("//aside//i[contains(concat(' ',normalize-space(@class),' '),' fa-clock ')]/../span").InnerText.Replace("\n", "");