Esempio n. 1
0
        private async Task SetCategoryPageTask(SpiderLog spiderLog, IWebDriver webDriver)
        {
            var htmlElement = webDriver.FindElement(By.TagName("html"));
            var title       = htmlElement.FindValueByCss(".anim_title_text a@text");
            var imgSrc      = htmlElement.FindValueByCss(".anim_intro_ptext img@src");
            var tagsTmpArr  = htmlElement.FindMultiValueByCss(".anim-main_list td@text");
            var tags        = FilterTagsTmpArr(tagsTmpArr);

            tags.Add("动漫之家");
            uploderCreator.CreateCategory(title, imgSrc, tags.ToArray());

            var excutor             = TaskExutor.Instance;
            var detailPageAElements = htmlElement.FindElements(By.CssSelector(".cartoon_online_border a"));
            var detailOrder         = 0;
            var index = detailPageAElements.Count;

            foreach (var aElement in detailPageAElements)
            {
                var href          = aElement.GetAttribute("href");
                var contentTitle  = aElement.GetAttribute("innerText");
                var _contentTitle = Regex.Replace(contentTitle, @"\d+p", string.Empty);

                uploderCreator.CreateContent(_contentTitle, title, detailOrder);
                await excutor.SetTaskWithParentUrl(href, spiderLog.TargetUrl, title, index, "dongmanzhijiaDetailPage");

                detailOrder++;
                index--;
            }
        }
Esempio n. 2
0
        private async Task SetCategoryPageTask(SpiderLog spiderLog, IWebDriver webDriver)
        {
            var htmlElement = webDriver.FindElement(By.TagName("html"));
            var title       = htmlElement.FindValueByCss(".book-title@text");
            var imgSrc      = htmlElement.FindValueByCss(".hcover img@src");
            var tagsTmpArr  = htmlElement.FindMultiValueByCss(".detail-list li span@text");
            var tags        = FilterTagsTmpArr(tagsTmpArr);

            tags.Add("漫画柜");
            uploderCreator.CreateCategory(title, imgSrc, tags.ToArray());

            var excutor             = TaskExutor.Instance;
            var detailPageAElements = htmlElement.FindElements(By.CssSelector(".chapter-list a"));
            var detailOrder         = 0;
            var index = detailPageAElements.Count;

            foreach (var aElement in detailPageAElements)
            {
                var href          = aElement.GetAttribute("href");
                var contentTitle  = aElement.GetAttribute("innerText");
                var _contentTitle = Regex.Replace(contentTitle, @"\d+p", string.Empty);

                uploderCreator.CreateContent(_contentTitle, title, detailOrder);
                await excutor.SetTaskWithParentUrl(href, spiderLog.TargetUrl, title, index, "manhuaguiDetailPage");

                detailOrder++;
                index--;
            }
        }