Compare commits

..

No commits in common. "38df54baffac5056619a9f4a2b9b144a3c7fd227" and "3381909afdc053d3a41147b6c68c1cb4b9330009" have entirely different histories.

2 changed files with 7 additions and 16 deletions

View File

@ -139,16 +139,15 @@ public class Bato : MangaConnector
HtmlNode chapterList =
result.htmlDocument.DocumentNode.SelectSingleNode("/html/body/div/main/div[3]/astro-island/div/div[2]/div/div/astro-slot");
Regex numberRex = new(@"\/title\/.+\/[0-9]+(-vol_([0-9]+))?-ch_([0-9\.]+)");
Regex chapterNumberRex = new(@"\/title\/.+\/[0-9]+-ch_([0-9\.]+)");
foreach (HtmlNode chapterInfo in chapterList.SelectNodes("div"))
{
HtmlNode infoNode = chapterInfo.FirstChild.FirstChild;
string chapterUrl = infoNode.GetAttributeValue("href", "");
Match match = numberRex.Match(chapterUrl);
string? volumeNumber = match.Groups[2].Success ? match.Groups[2].Value : null;
string chapterNumber = match.Groups[3].Value;
string? volumeNumber = null;
string chapterNumber = chapterNumberRex.Match(chapterUrl).Groups[1].Value;
string chapterName = chapterNumber;
string url = $"https://bato.to{chapterUrl}?load=2";
ret.Add(new Chapter(manga, chapterName, volumeNumber, chapterNumber, url));
@ -206,8 +205,7 @@ public class Bato : MangaConnector
string weirdString = images.OuterHtml;
string weirdString2 = Regex.Match(weirdString, @"props=\""(.*)}\""").Groups[1].Value;
string[] urls = Regex.Matches(weirdString2, @"(https:\/\/[A-z\-0-9\.\?\&\;\=\/]+)\\")
.Select(match => match.Groups[1].Value.Replace("&", "&")).ToArray();
string[] urls = Regex.Matches(weirdString2, @"https:\/\/[A-z\-0-9\.\?\&\;\=\/]*").Select(m => m.Value.Replace("\\"]", "").Replace("amp;", "")).ToArray();
return urls;
}

View File

@ -37,17 +37,10 @@ internal class HttpDownloadClient : DownloadClient
{
response = Client.Send(requestMessage);
}
catch (Exception e)
catch (TaskCanceledException e)
{
switch (e)
{
case TaskCanceledException:
Log($"Request timed out.\n\r{e}");
return new RequestResult(HttpStatusCode.RequestTimeout, null, Stream.Null);
case HttpRequestException:
Log($"Request failed\n\r{e}");
return new RequestResult(HttpStatusCode.BadRequest, null, Stream.Null);
}
}
}