2
0

Fix Mangaworld #103 Plurals

This commit is contained in:
Glax 2024-02-07 19:23:55 +01:00
parent bb6c553afa
commit c03e927565

View File

@ -69,7 +69,7 @@ public class Mangaworld: MangaConnector
if (requestResult.htmlDocument is null) if (requestResult.htmlDocument is null)
return null; return null;
Regex idRex = new (@"https:\/\/www\.mangaworld\.[a-z]{0,63}\/manga\/([0-9]+\/[0-9A-z\-]+)"); Regex idRex = new (@"https:\/\/www\.mangaworld\.[a-z]{0,63}\/manga\/([0-9]+\/[0-9A-z\-]+)\/.*");
string id = idRex.Match(url).Groups[1].Value; string id = idRex.Match(url).Groups[1].Value;
return ParseSinglePublicationFromHtml(requestResult.htmlDocument, id); return ParseSinglePublicationFromHtml(requestResult.htmlDocument, id);
} }
@ -87,19 +87,19 @@ public class Mangaworld: MangaConnector
HtmlNode metadata = infoNode.Descendants().First(d => d.HasClass("meta-data")); HtmlNode metadata = infoNode.Descendants().First(d => d.HasClass("meta-data"));
HtmlNode altTitlesNode = metadata.SelectSingleNode("//span[text()='Titoli alternativi: ']/..").ChildNodes[1]; HtmlNode altTitlesNode = metadata.SelectSingleNode("//span[text()='Titoli alternativi: ' or text()='Titolo alternativo: ']/..").ChildNodes[1];
string[] alts = altTitlesNode.InnerText.Split(", "); string[] alts = altTitlesNode.InnerText.Split(", ");
for(int i = 0; i < alts.Length; i++) for(int i = 0; i < alts.Length; i++)
altTitles.Add(i.ToString(), alts[i]); altTitles.Add(i.ToString(), alts[i]);
HtmlNode genresNode = HtmlNode genresNode =
metadata.SelectSingleNode("//span[text()='Generi: ']/.."); metadata.SelectSingleNode("//span[text()='Generi: ' or text()='Genero: ']/..");
HashSet<string> tags = genresNode.SelectNodes("a").Select(node => node.InnerText).ToHashSet(); HashSet<string> tags = genresNode.SelectNodes("a").Select(node => node.InnerText).ToHashSet();
HtmlNode authorsNode = HtmlNode authorsNode =
metadata.SelectSingleNode("//span[text()='Autore: ']/.."); metadata.SelectSingleNode("//span[text()='Autore: ' or text()='Autori: ']/..");
string[] authors = new[] { authorsNode.SelectNodes("a").First().InnerText }; string[] authors = authorsNode.SelectNodes("a").Select(node => node.InnerText).ToArray();
string status = metadata.SelectSingleNode("//span[text()='Stato: ']/..").SelectNodes("a").First().InnerText; string status = metadata.SelectSingleNode("//span[text()='Stato: ']/..").SelectNodes("a").First().InnerText;
// ReSharper disable 5 times StringLiteralTypo // ReSharper disable 5 times StringLiteralTypo