mirror of
https://github.com/C9Glax/tranga.git
synced 2025-06-14 07:17:54 +02:00
[postgres-Server-V2] feat: Convert chapterNumeber to string
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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 &&
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user