public ChapterObject ParseChapterObject(string content) { HtmlDocument ChapterObjectDocument = new HtmlDocument(); ChapterObjectDocument.LoadHtml(content); ChapterObject ParsedChapterObject = new ChapterObject(); HtmlNodeCollection PageNodes = ChapterObjectDocument.GetElementbyId("page_select").SelectNodes(".//option"); if (PageNodes != null && PageNodes.Count > 0) { foreach (HtmlNode PageNode in PageNodes) { HtmlNode PrevNode = PageNode.SelectSingleNode(".//preceding-sibling::option"), NextNode = PageNode.SelectSingleNode(".//following-sibling::option"); UInt32 PageNumber = UInt32.Parse(PageNode.NextSibling.InnerText.Substring(5)); String PageUrl = PageNode.Attributes["value"].Value, NextPageUrl = (NextNode != null) ? NextNode.Attributes["value"].Value : null, PrevPageUrl = (PrevNode != null) ? PrevNode.Attributes["value"].Value : null; if (!String.IsNullOrWhiteSpace(PageUrl)) { String PageHash = PageUrl.Split('#').Last().Split('_').First(); PageUrl = String.Format("https://bato.to/areader?id={0}&p={1}&supress_webtoon=t", PageHash, PageNumber); } if (!String.IsNullOrWhiteSpace(NextPageUrl)) { String PageHash = NextPageUrl.Split('#').Last().Split('_').First(); NextPageUrl = String.Format("https://bato.to/areader?id={0}&p={1}&supress_webtoon=t", PageHash, PageNumber + 1); } if (!String.IsNullOrWhiteSpace(PrevPageUrl)) { String PageHash = PrevPageUrl.Split('#').Last().Split('_').First(); PrevPageUrl = String.Format("https://bato.to/areader?id={0}&p={1}&supress_webtoon=t", PageHash, PageNumber - 1); } ParsedChapterObject.Pages.Add(new PageObject() { PageNumber = PageNumber, Url = PageUrl, NextUrl = NextPageUrl, PrevUrl = PrevPageUrl }); } } return(ParsedChapterObject); }