Esempio n. 1
0
        public async Task <int> GetChapterCountAsync(string ncode)
        {
            var url  = new NarouUrlBuilder().WithNCode(ncode).ToString();
            var text = await this.ReceiveAsync(url);

            var parser = new HtmlParser();

            using (var html = await parser.ParseAsync(text))
            {
                return(html.QuerySelectorAll("dd > a").Length);
            }
        }
Esempio n. 2
0
        public async Task <string> GetChapterTitleAsync(string ncode, int index)
        {
            var url  = new NarouUrlBuilder().WithNCode(ncode).WithIndex(index).ToString();
            var text = await this.ReceiveAsync(url);

            var parser = new HtmlParser();

            using (var html = await parser.ParseAsync(text))
            {
                var title = html.GetElementsByClassName("novel_subtitle").First();
                return(title.TextContent);
            }
        }
Esempio n. 3
0
        public async Task <(string Title, string Writer)> GetSummaryAsync(string ncode)
        {
            var url  = new NarouUrlBuilder().WithNCode(ncode).ToString();
            var text = await this.ReceiveAsync(url);

            var parser = new HtmlParser();

            using (var html = await parser.ParseAsync(text))
            {
                var title  = html.GetElementsByClassName("novel_title").First();
                var writer = html.GetElementsByClassName("novel_writername").First().FirstElementChild;

                return(title.TextContent, writer.TextContent);
            }
        }
Esempio n. 4
0
        public async Task <string> GetChapterContentAsync(string ncode, int index)
        {
            var url  = new NarouUrlBuilder().WithNCode(ncode).WithIndex(index).ToString();
            var text = await this.ReceiveAsync(url);

            var parser = new HtmlParser();

            using (var html = await parser.ParseAsync(text))
            {
                var contentBuilder = new StringBuilder();
                foreach (var e in html.GetElementsByClassName("novel_view"))
                {
                    contentBuilder.AppendLine(e.TextContent);
                }
                return(contentBuilder.ToString());
            }
        }