Skip to content

Commit

Permalink
Merge pull request 'Fix #66 Mangasee search and parsing' (!59) from c…
Browse files Browse the repository at this point in the history
…uttingedge into master

Reviewed-on: https://git.bernloehr.eu/glax/Tranga/pulls/59
  • Loading branch information
glax committed Oct 14, 2023
2 parents f01a786 + 726be70 commit fd9319d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Tranga/MangaConnectors/Mangasee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public Mangasee(GlobalBase clone) : base(clone, "Mangasee")
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);
Expand Down Expand Up @@ -47,6 +47,11 @@ public override Manga[] GetManga(string publicationTitle = "")
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<Manga>();
}
Log($"{resultsNode.SelectNodes("div").Count} items.");

HashSet<Manga> ret = new();
Expand Down

0 comments on commit fd9319d

Please sign in to comment.