[postgres-Server-V2] feat: Convert chapterNumeber to string

This commit is contained in:
Alessandro Benetton
2025-01-25 11:57:54 +01:00
parent be6b3da1be
commit ebe7e145aa
31 changed files with 881 additions and 430 deletions

View File

@ -152,9 +152,7 @@ public class AsuraToon : MangaConnector
string chapterUrl = chapterInfo.GetAttributeValue("href", "");
Match match = infoRex.Match(chapterInfo.InnerText);
if(!ChapterNumber.CanParse(match.Groups[1].Value))
continue;
ChapterNumber chapterNumber = new(match.Groups[1].Value);
string chapterNumber = new(match.Groups[1].Value);
string? chapterName = match.Groups[2].Success && match.Groups[2].Length > 1 ? match.Groups[2].Value : null;
string url = $"https://asuracomic.net/series/{chapterUrl}";
try

View File

@ -159,9 +159,7 @@ public class Bato : MangaConnector
Match match = numberRex.Match(chapterUrl);
string id = match.Groups[1].Value;
int? volumeNumber = match.Groups[2].Success ? int.Parse(match.Groups[2].Value) : null;
if(ChapterNumber.CanParse(match.Groups[3].Value))
continue;
ChapterNumber chapterNumber = new(match.Groups[3].Value);
string chapterNumber = new(match.Groups[3].Value);
string url = $"https://bato.to{chapterUrl}?load=2";
try
{

View File

@ -229,9 +229,7 @@ public class MangaDex : MangaConnector
? attributes["chapter"]!.GetValue<string>()
: null;
if(chapterNumStr is null || ChapterNumber.CanParse(chapterNumStr))
continue;
ChapterNumber chapterNumber = new(chapterNumStr);
string chapterNumber = new(chapterNumStr);
if (attributes.ContainsKey("pages") && attributes["pages"] is not null &&

View File

@ -128,9 +128,7 @@ public class MangaHere : MangaConnector
Match rexMatch = chapterRex.Match(url);
int? volumeNumber = rexMatch.Groups[1].Value == "TBD" ? null : int.Parse(rexMatch.Groups[1].Value);
if(!ChapterNumber.CanParse(rexMatch.Groups[2].Value))
continue;
ChapterNumber chapterNumber = new(rexMatch.Groups[2].Value);
string chapterNumber = new(rexMatch.Groups[2].Value);
string fullUrl = $"https://www.mangahere.cc{url}";
try

View File

@ -185,9 +185,8 @@ public class MangaKatana : MangaConnector
.GetAttributeValue("href", "");
int? volumeNumber = volumeRex.IsMatch(url) ? int.Parse(volumeRex.Match(url).Groups[1].Value) : null;
if(!ChapterNumber.CanParse(chapterNumRex.Match(url).Groups[1].Value))
continue;
ChapterNumber chapterNumber = new(chapterNumRex.Match(url).Groups[1].Value);
string chapterNumber = new(chapterNumRex.Match(url).Groups[1].Value);
string chapterName = chapterNameRex.Match(fullString).Groups[1].Value;
try
{

View File

@ -151,9 +151,8 @@ public class MangaLife : MangaConnector
? int.Parse(rexMatch.Groups[3].Value)
: null;
if(!ChapterNumber.CanParse(rexMatch.Groups[1].Value))
continue;
ChapterNumber chapterNumber = new(rexMatch.Groups[1].Value);
string chapterNumber = new(rexMatch.Groups[1].Value);
string fullUrl = $"https://manga4life.com{url}";
fullUrl = fullUrl.Replace(Regex.Match(url,"(-page-[0-9])").Value,"");
try

View File

@ -181,9 +181,7 @@ public class Manganato : MangaConnector
int? volumeNumber = volRex.IsMatch(fullString)
? int.Parse(volRex.Match(fullString).Groups[1].Value)
: null;
if(!ChapterNumber.CanParse(chapterRex.Match(url).Groups[1].Value))
continue;
ChapterNumber chapterNumber = new(chapterRex.Match(url).Groups[1].Value);
string chapterNumber = new(chapterRex.Match(url).Groups[1].Value);
string chapterName = nameRex.Match(fullString).Groups[3].Value;
try
{

View File

@ -158,9 +158,8 @@ public class Mangaworld : MangaConnector
{
string numberStr = chapterRex.Match(chNode.SelectSingleNode("a").SelectSingleNode("span").InnerText).Groups[1].Value;
if(!ChapterNumber.CanParse(numberStr))
continue;
ChapterNumber chapterNumber = new(numberStr);
string chapterNumber = new(numberStr);
string url = chNode.SelectSingleNode("a").GetAttributeValue("href", "");
string id = idRex.Match(chNode.SelectSingleNode("a").GetAttributeValue("href", "")).Groups[1].Value;
try
@ -178,9 +177,8 @@ public class Mangaworld : MangaConnector
foreach (HtmlNode chNode in chaptersWrapper.SelectNodes("div").Where(node => node.HasClass("chapter")))
{
string numberStr = chapterRex.Match(chNode.SelectSingleNode("a").SelectSingleNode("span").InnerText).Groups[1].Value;
if(!ChapterNumber.CanParse(numberStr))
continue;
ChapterNumber chapterNumber = new(numberStr);
string chapterNumber = new(numberStr);
string url = chNode.SelectSingleNode("a").GetAttributeValue("href", "");
string id = idRex.Match(chNode.SelectSingleNode("a").GetAttributeValue("href", "")).Groups[1].Value;
try

View File

@ -148,9 +148,7 @@ public class ManhuaPlus : MangaConnector
{
Match rexMatch = urlRex.Match(url);
if(!ChapterNumber.CanParse(rexMatch.Groups[1].Value))
continue;
ChapterNumber chapterNumber = new(rexMatch.Groups[1].Value);
string chapterNumber = new(rexMatch.Groups[1].Value);
string fullUrl = url;
try
{

View File

@ -157,7 +157,7 @@ public class Weebcentral : MangaConnector
public override Chapter[] GetChapters(Manga manga, string language = "en")
{
var requestUrl = $"{_baseUrl}/series/{manga.MangaId}/full-chapter-list";
var requestUrl = $"{_baseUrl}/series/{manga.ConnectorId}/full-chapter-list";
var requestResult =
downloadClient.MakeRequest(requestUrl, RequestType.Default);
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
@ -182,7 +182,7 @@ public class Weebcentral : MangaConnector
var url = elem.GetAttributeValue("href", "") ?? "Undefined";
if (!url.StartsWith("https://") && !url.StartsWith("http://"))
return new Chapter(manga, "undefined", new ChapterNumber(-1), null, null);
return new Chapter(manga, "undefined", "-1", null, null);
var idMatch = idRex.Match(url);
var id = idMatch.Success ? idMatch.Groups[1].Value : null;
@ -192,12 +192,13 @@ public class Weebcentral : MangaConnector
var chapterNumberMatch = chapterRex.Match(chapterNode);
if(!chapterNumberMatch.Success || !ChapterNumber.CanParse(chapterNumberMatch.Groups[1].Value))
return new Chapter(manga, "undefined", new ChapterNumber(-1), null, null);
ChapterNumber chapterNumber = new(chapterNumberMatch.Groups[1].Value);
if(!chapterNumberMatch.Success)
return new Chapter(manga, "undefined", "-1", null, null);
return new Chapter(manga, url, chapterNumber, null, null);
}).Where(elem => elem.ChapterNumber < ChapterNumber.Zero && elem.Url != "undefined").ToList();
string chapterNumber = new(chapterNumberMatch.Groups[1].Value);
var chapter = new Chapter(manga, url, chapterNumber, null, null);
return chapter;
}).Where(elem => elem.ChapterNumber.CompareTo("-1") != 0 && elem.Url != "undefined").ToList();
ret.Reverse();
return ret;