Requested changes
This commit is contained in:
parent
7c7d43021e
commit
b995fc568a
@ -154,7 +154,7 @@ public class MangaKatana : MangaConnector
|
|||||||
//Return Chapters ordered by Chapter-Number
|
//Return Chapters ordered by Chapter-Number
|
||||||
List<Chapter> chapters = ParseChaptersFromHtml(manga, requestUrl);
|
List<Chapter> chapters = ParseChaptersFromHtml(manga, requestUrl);
|
||||||
Log($"Got {chapters.Count} chapters. {manga}");
|
Log($"Got {chapters.Count} chapters. {manga}");
|
||||||
return chapters.OrderBy(chapter => chapter.chapterNumber ?? chapter.volumeNumber).ToArray();
|
return chapters.OrderBy(chapter => Convert.ToSingle(chapter.chapterNumber, numberFormatDecimalPoint)).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Chapter> ParseChaptersFromHtml(Manga manga, string mangaUrl)
|
private List<Chapter> ParseChaptersFromHtml(Manga manga, string mangaUrl)
|
||||||
@ -167,18 +167,17 @@ public class MangaKatana : MangaConnector
|
|||||||
|
|
||||||
HtmlNode chapterList = document.DocumentNode.SelectSingleNode("//div[contains(@class, 'chapters')]/table/tbody");
|
HtmlNode chapterList = document.DocumentNode.SelectSingleNode("//div[contains(@class, 'chapters')]/table/tbody");
|
||||||
|
|
||||||
Regex volumeRex = new(@"(Volume ([0-9]+))|(Vol\.[0-9]+)");
|
Regex volumeRex = new(@"[0-9a-z\-\.]+\/[0-9a-z\-]*v([0-9\.]+)");
|
||||||
Regex chapterNumRex = new(@"https:\/\/mangakatana\.com\/manga\/.+\/(c([0-9\.]+))|(v[0-9]+c[0-9]+)");
|
Regex chapterNumRex = new(@"[0-9a-z\-\.]+\/[0-9a-z\-]*c([0-9\.]+)");
|
||||||
Regex chapterNameRex = new(@"Chapter [0-9\.]+:? (.*)");
|
Regex chapterNameRex = new(@"Chapter [0-9\.]+:? (.*)");
|
||||||
|
|
||||||
|
|
||||||
foreach (HtmlNode chapterInfo in chapterList.Descendants("tr"))
|
foreach (HtmlNode chapterInfo in chapterList.Descendants("tr"))
|
||||||
{
|
{
|
||||||
string fullString = chapterInfo.Descendants("a").First().InnerText;
|
string fullString = chapterInfo.Descendants("a").First().InnerText;
|
||||||
string url = chapterInfo.Descendants("a").First()
|
string url = chapterInfo.Descendants("a").First()
|
||||||
.GetAttributeValue("href", "");
|
.GetAttributeValue("href", "");
|
||||||
|
|
||||||
string? volumeNumber = volumeRex.IsMatch(fullString) ? volumeRex.Match(fullString).Groups[1].Value : null;
|
string? volumeNumber = volumeRex.IsMatch(url) ? volumeRex.Match(url).Groups[1].Value : null;
|
||||||
string chapterNumber = chapterNumRex.Match(url).Groups[1].Value;
|
string chapterNumber = chapterNumRex.Match(url).Groups[1].Value;
|
||||||
string chapterName = chapterNameRex.Match(fullString).Groups[1].Value;
|
string chapterName = chapterNameRex.Match(fullString).Groups[1].Value;
|
||||||
ret.Add(new Chapter(manga, chapterName, volumeNumber, chapterNumber, url));
|
ret.Add(new Chapter(manga, chapterName, volumeNumber, chapterNumber, url));
|
||||||
|
Loading…
Reference in New Issue
Block a user