コード例 #1
0
        public override List <Manga> ReadHtml()
        {
            List <Manga> lMangas = new List <Manga>();
            string       sResult = CrawlSite();
            HtmlDocument oDoc    = new HtmlDocument();

            oDoc.LoadHtml(sResult);

            if (oDoc.ParseErrors != null && oDoc.ParseErrors.Count() > 0)
            {
            }
            else
            if (oDoc.DocumentNode != null)
            {
                HtmlNodeCollection lNodes = oDoc.DocumentNode.SelectNodes("//li[div[@class='cover' or @class='intro']]");
                if (lNodes != null)
                {
                    foreach (HtmlNode oNode in lNodes)
                    {
                        Manga oManga = new Manga();

                        foreach (HtmlNode oDivNode in oNode.SelectNodes("div"))
                        {
                            if (oDivNode.Attributes.Any(x => x.Value.Equals("cover")))
                            {
                                GetMangaLink(oManga, oDivNode);
                                GetCoverLink(oManga, oDivNode);
                            }
                            else if (oDivNode.Attributes.Any(x => x.Value.Equals("intro")))
                            {
                                GetTitle(oManga, oDivNode);
                                GetMangaLink(oManga, oDivNode);
                                GetChapter(oManga, oDivNode);
                                GetChapterLink(oManga, oDivNode);
                                GetDescription(oManga, oDivNode);
                            }
                        }

                        oManga.FormatChapter();

                        lMangas.Add(oManga);
                    }
                }
            }

            return(lMangas);
        }
コード例 #2
0
ファイル: TaaddCrawler.cs プロジェクト: khalydor/MangaViewer
        public override List<Manga> ReadHtml()
        {
            List<Manga> lMangas = new List<Manga>();
            string sResult = CrawlSite();
            HtmlDocument oDoc = new HtmlDocument();
            oDoc.LoadHtml(sResult);

            if (oDoc.ParseErrors != null && oDoc.ParseErrors.Count() > 0)
            {

            }
            else
                if (oDoc.DocumentNode != null)
            {
                HtmlNodeCollection lNodes = oDoc.DocumentNode.SelectNodes("//li[div[@class='cover' or @class='intro']]");
                if (lNodes != null)
                    foreach (HtmlNode oNode in lNodes)
                    {
                        Manga oManga = new Manga();

                        foreach (HtmlNode oDivNode in oNode.SelectNodes("div"))
                            if (oDivNode.Attributes.Any(x => x.Value.Equals("cover")))
                            {
                                GetMangaLink(oManga, oDivNode);
                                GetCoverLink(oManga, oDivNode);
                            }
                            else if (oDivNode.Attributes.Any(x => x.Value.Equals("intro")))
                            {
                                GetTitle(oManga, oDivNode);
                                GetMangaLink(oManga, oDivNode);
                                GetChapter(oManga, oDivNode);
                                GetChapterLink(oManga, oDivNode);
                                GetDescription(oManga, oDivNode);
                            }

                        oManga.FormatChapter();

                        lMangas.Add(oManga);
                    }
            }

            return lMangas;
        }