From 19c9ecb3e71ee6a08172a60aecfa73d9388e50ca Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 14 Oct 2023 12:49:18 +0200 Subject: [PATCH 1/2] #66 Mangasee empty search breaks --- Tranga/MangaConnectors/Mangasee.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Tranga/MangaConnectors/Mangasee.cs b/Tranga/MangaConnectors/Mangasee.cs index 22ae2ed..651a2ce 100644 --- a/Tranga/MangaConnectors/Mangasee.cs +++ b/Tranga/MangaConnectors/Mangasee.cs @@ -47,6 +47,11 @@ public class Mangasee : MangaConnector private Manga[] ParsePublicationsFromHtml(HtmlDocument document) { HtmlNode resultsNode = document.DocumentNode.SelectSingleNode("//div[@class='BoxBody']/div[last()]/div[1]/div"); + if (resultsNode.Descendants("div").Count() == 1 && resultsNode.Descendants("div").First().HasClass("NoResults")) + { + Log("No results."); + return Array.Empty(); + } Log($"{resultsNode.SelectNodes("div").Count} items."); HashSet ret = new(); From 726be70af337c4534d4f62c590eec685e2b6b072 Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 14 Oct 2023 12:59:35 +0200 Subject: [PATCH 2/2] #66 Mangasee search sanitization --- Tranga/MangaConnectors/Mangasee.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tranga/MangaConnectors/Mangasee.cs b/Tranga/MangaConnectors/Mangasee.cs index 651a2ce..508615c 100644 --- a/Tranga/MangaConnectors/Mangasee.cs +++ b/Tranga/MangaConnectors/Mangasee.cs @@ -19,7 +19,7 @@ public class Mangasee : MangaConnector public override Manga[] GetManga(string publicationTitle = "") { Log($"Searching Publications. Term=\"{publicationTitle}\""); - string sanitizedTitle = string.Join('+', Regex.Matches(publicationTitle, "[A-z]*").Where(str => str.Length > 0)).ToLower(); + string sanitizedTitle = WebUtility.UrlEncode(publicationTitle); string requestUrl = $"https://mangasee123.com/search/?name={sanitizedTitle}"; DownloadClient.RequestResult requestResult = downloadClient.MakeRequest(requestUrl, 1);