Finished MangaDexMetadataProvider logic.
This commit is contained in:
@@ -18,7 +18,7 @@ public class MangaNatoWebCrawler : MangaWebCrawler
|
||||
{
|
||||
Title = node.TitleNode?.InnerText ?? string.Empty,
|
||||
AlternateTitles = GetAlternateTitles(node.AlternateTitlesNode),
|
||||
Authors = GetAuthors(node.AuthorsNode),
|
||||
Contributors = GetContributors(node.AuthorsNode),
|
||||
Status = GetStatus(node.StatusNode),
|
||||
Genres = GetGenres(node.GenresNode),
|
||||
UpdateDate = GetUpdateDate(node.UpdateDateNode),
|
||||
@@ -32,20 +32,50 @@ public class MangaNatoWebCrawler : MangaWebCrawler
|
||||
return manga;
|
||||
}
|
||||
|
||||
private static List<string> GetAlternateTitles(HtmlNode? node)
|
||||
private static List<SourceMangaTitle> GetAlternateTitles(HtmlNode? node)
|
||||
{
|
||||
if (node == null)
|
||||
return [];
|
||||
|
||||
return [.. node.InnerText.Split(';').Select(x => x.Trim())];
|
||||
List<SourceMangaTitle> sourceMangaTitles = [];
|
||||
|
||||
string[] titles = [.. node.InnerText.Split(';').Select(x => x.Trim())];
|
||||
|
||||
foreach (string title in titles)
|
||||
{
|
||||
SourceMangaTitle sourceMangaTitle = new()
|
||||
{
|
||||
Title = title,
|
||||
Language = SourceMangaLanguage.Unknown
|
||||
};
|
||||
|
||||
sourceMangaTitles.Add(sourceMangaTitle);
|
||||
}
|
||||
|
||||
return [.. sourceMangaTitles];
|
||||
}
|
||||
|
||||
private static List<string> GetAuthors(HtmlNode? node)
|
||||
private static SourceMangaContributor[] GetContributors(HtmlNode? node)
|
||||
{
|
||||
if (node == null)
|
||||
return [];
|
||||
|
||||
return [.. node.InnerText.Split('-').Select(x => x.Trim())];
|
||||
List<SourceMangaContributor> contributors = [];
|
||||
|
||||
string[] names = [.. node.InnerText.Split('-').Select(x => x.Trim())];
|
||||
|
||||
foreach (string name in names)
|
||||
{
|
||||
SourceMangaContributor contributor = new()
|
||||
{
|
||||
Name = name,
|
||||
Role = SourceMangaContributorRole.Author
|
||||
};
|
||||
|
||||
contributors.Add(contributor);
|
||||
}
|
||||
|
||||
return [.. contributors];
|
||||
}
|
||||
|
||||
private static MangaStatus GetStatus(HtmlNode? node)
|
||||
@@ -138,7 +168,7 @@ public class MangaNatoWebCrawler : MangaWebCrawler
|
||||
SourceMangaChapter chapter = new()
|
||||
{
|
||||
Number = GetChapterNumber(chapterNameNode),
|
||||
Name = chapterNameNode?.InnerText ?? string.Empty,
|
||||
Title = chapterNameNode?.InnerText ?? string.Empty,
|
||||
Url = chapterNameNode?.Attributes["href"].Value ?? string.Empty,
|
||||
Views = GetViews(chapterViewNode),
|
||||
UploadDate = chapterTimeNode != null ? DateTime.Parse(chapterTimeNode.Attributes["title"].Value) : null
|
||||
|
||||
Reference in New Issue
Block a user