From 9ae8ca65dff308511ced66d5c53b9cc0cb35a68e Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 29 Jun 2023 21:09:42 +0200 Subject: [PATCH] resolves #25 characters encoding mistake --- API/RequestHandler.cs | 3 ++- Tranga/Connectors/Manganato.cs | 2 +- Tranga/Connectors/Mangasee.cs | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/API/RequestHandler.cs b/API/RequestHandler.cs index 4360f30..8986b54 100644 --- a/API/RequestHandler.cs +++ b/API/RequestHandler.cs @@ -87,7 +87,8 @@ public class RequestHandler foreach (string kvpair in query.Split('&').Where(str => str.Length >= 3)) { string var = kvpair.Split('=')[0]; - string val = kvpair.Substring(var.Length + 1); + string val = Regex.Replace(kvpair.Substring(var.Length + 1), "%20", " "); + val = Regex.Replace(val, "%[0-9]{2}", ""); ret.Add(var, val); } return ret; diff --git a/Tranga/Connectors/Manganato.cs b/Tranga/Connectors/Manganato.cs index 0b37933..e4356f0 100644 --- a/Tranga/Connectors/Manganato.cs +++ b/Tranga/Connectors/Manganato.cs @@ -23,7 +23,7 @@ public class Manganato : Connector public override Publication[] GetPublications(string publicationTitle = "") { logger?.WriteLine(this.GetType().ToString(), $"Getting Publications (title={publicationTitle})"); - string sanitizedTitle = string.Concat(Regex.Matches(publicationTitle, "[A-z]* *")).ToLower().Replace(' ', '_'); + string sanitizedTitle = string.Join('_', Regex.Matches(publicationTitle, "[A-z]*")).ToLower(); string requestUrl = $"https://manganato.com/search/story/{sanitizedTitle}"; DownloadClient.RequestResult requestResult = downloadClient.MakeRequest(requestUrl, (byte)1); diff --git a/Tranga/Connectors/Mangasee.cs b/Tranga/Connectors/Mangasee.cs index 56d5b36..6540d05 100644 --- a/Tranga/Connectors/Mangasee.cs +++ b/Tranga/Connectors/Mangasee.cs @@ -75,7 +75,6 @@ public class Mangasee : Connector public override Publication[] GetPublications(string publicationTitle = "") { logger?.WriteLine(this.GetType().ToString(), $"Getting Publications (title={publicationTitle})"); - string sanitizedTitle = string.Concat(Regex.Matches(publicationTitle, "[A-z]* *")).ToLower().Replace(' ', '+'); string requestUrl = $"https://mangasee123.com/_search.php"; DownloadClient.RequestResult requestResult = downloadClient.MakeRequest(requestUrl, (byte)1);