Exemplo n.º 1
0
        public override ComicInfo GetComicInfo(string response)//
        {
            int          len = 0;
            ComicInfo    info;
            HtmlDocument doc;

            info = new ComicInfo();
            doc  = new HtmlDocument();
            doc.LoadHtml(response);
            HtmlNodeCollection collect = doc.DocumentNode.SelectNodes("//ul[@class='detail-list cf']/li");

            len            = collect[1].SelectNodes("./span/a").Count - 1;
            info.Author    = collect[1].SelectNodes("./span/a")[len].Attributes["title"].Value;
            info.otherWork = homePage + collect[1].SelectNodes("./span/a")[len].Attributes["href"].Value;
            HtmlNode node = doc.DocumentNode.SelectSingleNode("//li[@class='status']");

            info.HasFinished = node.SelectNodes("./span/span")[0].InnerText;
            info.Tag         = collect[1].SelectNodes("./span/a")[0].InnerText;
            info.Description = doc.DocumentNode.SelectSingleNode("//div[@id='intro-cut']").InnerText;
            collect          = doc.DocumentNode.SelectNodes("//div[@class='chapter-list cf mt10']/ul/li/a");
            Dictionary <string, string> dict;

            dict = new Dictionary <string, string>();

            foreach (HtmlNode temp in collect)
            {
                if (dict.ContainsKey(temp.Attributes["title"].Value) == false)
                {
                    dict.Add(temp.Attributes["title"].Value, homePage + temp.Attributes["href"].Value);
                }
            }

            info.URLDictionary = dict;
            return(info);
        }
Exemplo n.º 2
0
        public override ComicInfo GetComicInfo(string response)
        {
            string subMsg = "";
            ComicInfo comicInfo = new ComicInfo();
            Dictionary<string,string> comicDic;
            Regex regex;
            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml(response);

            comicDic = new Dictionary<string,string>();
            regex = new Regex(@"src='(?<imgurl>[\w:/.]*)'");

            HtmlNodeCollection nodeCollection = doc.DocumentNode.SelectNodes("//a[@class='l_s']");
            
            foreach (HtmlNode node in nodeCollection)
            {
                if (comicDic.ContainsKey(node.Attributes["title"].Value) == false)
                {
                    comicDic.Add(node.Attributes["title"].Value, hostAttach + node.Attributes["href"].Value);
                }
            }

            HtmlNode currentNode = doc.DocumentNode.SelectSingleNode("//div[@id='about_kit']");
            nodeCollection = currentNode.SelectNodes("./ul/li");
            
            subMsg = AnalyseTool.GetTag(response, @"<div id=""about_style"">","</div>");
            comicInfo.CoverImgUrl = regex.Match(subMsg).Groups["imgurl"].Value;
            comicInfo.otherWork = "";
            comicInfo.Author = nodeCollection[1].InnerText.Trim().Replace("作者:","");
            comicInfo.HasFinished = nodeCollection[2].InnerText.Trim().Replace("状态:","");
            comicInfo.Description = nodeCollection[nodeCollection.Count - 1].InnerText.Trim().Replace("简介:","");
            comicInfo.URLDictionary = comicDic;
            return comicInfo;
        }
Exemplo n.º 3
0
        public override ComicInfo GetComicInfo(string response)
        {
            ComicInfo comicInfo = new ComicInfo();
            HtmlNode  mainNode  = GetMainNode(response);

            HtmlNode tempNode;
            HtmlNode node = mainNode.SelectSingleNode("//p[@class='detail-info-tip']");

            comicInfo.Author      = node.SelectSingleNode("./span/a").InnerText;
            comicInfo.HasFinished = node.SelectNodes("./span")[1].SelectSingleNode("./span").InnerText;

            tempNode = node.SelectNodes("./span")[2].SelectSingleNode("./span");

            if (tempNode != null)
            {
                comicInfo.Tag = tempNode.InnerText;
            }
            else
            {
                comicInfo.Tag = "无";
            }


            node = mainNode.SelectSingleNode("//p[@class='detail-info-content']");
            if (node != null)
            {
                comicInfo.Description = node.InnerText;
            }
            else
            {
                comicInfo.Description = node.SelectNodes("./span")[2].SelectSingleNode("./span").InnerText;
            }

            comicInfo.URLDictionary = new Dictionary <string, string>();

            HtmlNodeCollection htmlNodes = mainNode.SelectNodes("//div[@class='detail-list-form-con']/a");

            if (htmlNodes != null)
            {
                foreach (HtmlNode temp in htmlNodes)
                {
                    string name = temp.InnerText.Replace(" ", "");

                    if (!comicInfo.URLDictionary.ContainsKey(name))
                    {
                        comicInfo.URLDictionary.Add(name, host + temp.Attributes["href"].Value);
                    }
                }
            }
            return(comicInfo);
        }
Exemplo n.º 4
0
        public override ComicInfo GetComicInfo(string response)
        {
            HtmlNode  node;
            ComicInfo comicInfo;

            comicInfo = new ComicInfo();
            HtmlDocument doc = new HtmlDocument();
            Dictionary <string, string> dict;

            doc.LoadHtml(response);
            dict = new Dictionary <string, string>();

            try
            {
                node = doc.DocumentNode.SelectSingleNode("//div[@class='sectioninfo allfloatleft gray']");
                HtmlNodeCollection collect = node.SelectNodes("./p");
                comicInfo.Author      = collect[1].SelectSingleNode("./span/a").InnerText;
                comicInfo.HasFinished = AnalyseTool.ReplacePunctuation(collect[2].SelectSingleNode("./span/a").InnerText);
                comicInfo.Tag         = collect[3].SelectSingleNode("./span/a").InnerText;
                node = doc.DocumentNode.SelectSingleNode("//div[@id='mhlist']");

                if (node == null)
                {
                    comicInfo.Description   = "因版权、国家法规等原因,动漫在线暂停提供此漫画的在线观看,欢迎大家继续观看其他精彩漫画,此漫画恢复情况请关注动漫在线";
                    comicInfo.URLDictionary = new Dictionary <string, string>();
                    return(comicInfo);
                }

                collect = node.SelectNodes("./ul/li/a");

                foreach (HtmlNode temp in collect)
                {
                    if (dict.ContainsKey(temp.Attributes["title"].Value) == false)
                    {
                        dict.Add(temp.Attributes["title"].Value, temp.Attributes["href"].Value);
                    }
                }

                node = doc.DocumentNode.SelectSingleNode("//div[@id='mh_smalltext']");
                comicInfo.Description   = node.InnerText;
                comicInfo.URLDictionary = dict;
            }
            catch (Exception ex)
            {
                comicInfo.Description   = "该漫画已下架";
                comicInfo.URLDictionary = new Dictionary <string, string>();
                return(comicInfo);
            }
            return(comicInfo);
        }
Exemplo n.º 5
0
        public override ComicInfo GetComicInfo(string response)
        {
            ComicInfo comicInfo;

            comicInfo = new ComicInfo();
            HtmlNode mainNode = GetMainNode(response);

            if (mainNode == null)
            {
                return(comicInfo);
            }

            HtmlNode           node    = mainNode.SelectSingleNode("//div[@id='about_kit']");
            HtmlNodeCollection collect = node.SelectNodes("./ul/li");

            if (collect != null)
            {
                comicInfo.Author      = collect[1].InnerText.Replace("作者:", "");;
                comicInfo.HasFinished = collect[2].InnerText.Replace("状态:", "");
                comicInfo.Description = collect[collect.Count - 1].InnerText.Replace("简介:", "");
                comicInfo.Tag         = "无";
            }

            collect = mainNode.SelectNodes("//ul[@class='cVolUl']/li/a");

            if (collect != null)
            {
                Dictionary <string, string> dict = new Dictionary <string, string>();
                string key = "";

                foreach (HtmlNode nodeTemp in collect)
                {
                    key = nodeTemp.Attributes["title"].Value;

                    if (dict.ContainsKey(key) == false)
                    {
                        dict.Add(key, hostName + nodeTemp.Attributes["href"].Value);
                    }
                }

                comicInfo.URLDictionary = dict;
            }

            return(comicInfo);
        }
Exemplo n.º 6
0
        public override ComicInfo GetComicInfo(string response)
        {
            string             desc      = "";
            ComicInfo          comicInfo = new ComicInfo();
            HtmlNode           mainNode  = GetMainNode(response);
            HtmlNode           node      = mainNode.SelectSingleNode("//ul[@class='comic_deCon_liO']");
            HtmlNodeCollection collect   = node.SelectNodes("./li/a");


            if (collect != null)
            {
                comicInfo.Author      = collect[0].InnerText;
                comicInfo.HasFinished = collect[1].InnerText;
                comicInfo.Tag         = collect[2].InnerText;
                comicInfo.otherWork   = hostName + collect[0].Attributes["href"].Value;
                desc = mainNode.SelectSingleNode("//p[@class='comic_deCon_d']").InnerText.Trim();
                comicInfo.Description = desc.Substring(desc.IndexOf(":") + 1);
            }

            collect = mainNode.SelectNodes("//ul[@id='chapter-list-1']/li/a");

            if (collect != null)
            {
                string key = "";
                Dictionary <string, string> dict = new Dictionary <string, string>();

                foreach (HtmlNode temp in collect)
                {
                    key = temp.Attributes["title"].Value;

                    if (dict.ContainsKey(key) == false)
                    {
                        dict.Add(key, hostName + temp.Attributes["href"].Value);
                    }
                }

                comicInfo.URLDictionary = dict;
            }

            return(comicInfo);
        }
Exemplo n.º 7
0
        public override ComicInfo GetComicInfo(string response)
        {
            string       temp;
            HtmlDocument doc;

            doc = new HtmlDocument();
            doc.LoadHtml(response);
            ComicInfo comicInfo = new ComicInfo();
            Dictionary <string, string> dict;

            dict = new Dictionary <string, string>();
            HtmlNode node = doc.DocumentNode.SelectSingleNode("//div[@class='banner_detail_form']/div[@class='info']");

            comicInfo.Author    = node.SelectSingleNode("./p[@class='subtitle']").InnerText.Replace("作者:", "");
            comicInfo.otherWork = hostAttach + node.SelectSingleNode("./p[@class='subtitle']/a").Attributes["href"].Value;

            HtmlNode nodeTemp = node.SelectSingleNode("./p[@class='tip']");

            comicInfo.HasFinished = nodeTemp.SelectNodes("./span")[0].InnerText.Replace("状态:", "");

            if (nodeTemp.SelectNodes("./span").Count == 2)
            {
                comicInfo.Tag = nodeTemp.SelectNodes("./span")[1].InnerText.Replace("题材:", "").Replace(" ", "");
            }

            comicInfo.Description = node.SelectSingleNode("./p[@class='content']").InnerText;
            node = doc.DocumentNode.SelectSingleNode("//div[@id='chapterlistload']/ul");

            foreach (HtmlNode tempNode in node.SelectNodes("./li/a|./ul/li/a"))
            {
                temp = tempNode.InnerText.Replace(" ", "");

                if (dict.ContainsKey(temp) == false)
                {
                    dict.Add(temp, hostAttach + tempNode.Attributes["href"].Value);
                }
            }
            comicInfo.URLDictionary = dict;
            return(comicInfo);
        }
Exemplo n.º 8
0
        public override ComicInfo GetComicInfo(string response)
        {
            ComicInfo comicInfo = new ComicInfo();
            Dictionary <string, string> dict;

            dict = new Dictionary <string, string>();
            var comicStr  = AnalyseTool.GetTag(response, @"<div class=""cShuoMing"">", "</div>");
            var descrtion = AnalyseTool.GetTag(response, @"<div class=""cInfoArea"">", "</div>");

            descrtion = AnalyseTool.ReplacePunctuation(descrtion);
            Regex[] regex = new Regex[6];
            regex[0] = new Regex(@"""cInfoArea"">\s*(?<descr>[\w+“”,。!]*)");
            regex[1] = new Regex(@"<span\sclass=""cInfoLianWan"">(?<status>[\w\s]*)");             //连载状态
            regex[2] = new Regex(@"<a\starget=_blank\s*href='[?./\w=%]*'>(?<author>\w+)</a></td"); //作者及相关作品
            regex[3] = new Regex(@"<a\s*href='[/\w-]*'>(?<tag>\w+)</a>");                          //漫画标签
            regex[4] = new Regex(@"<a\s*target='_blank'\s*href='(?<href>[\w/]*)'>(?<title>[\w\s().]*)");
            regex[5] = new Regex(@"img\s*src='(?<url>[\w:/._]*)");

            comicInfo.Description = regex[0].Match(descrtion).Groups["descr"].Value;
            comicInfo.HasFinished = regex[1].Match(comicStr).Groups["status"].Value.Replace("\r\n", "").Replace(" ", "");
            comicInfo.Author      = regex[2].Match(comicStr).Groups["author"].Value;
            comicInfo.Tag         = regex[3].Match(comicStr).Groups["tag"].Value;
            comicInfo.Year        = "略";

            MatchCollection collect = regex[4].Matches(response);

            foreach (Match m in collect)
            {
                if (dict.ContainsKey(m.Groups["title"].Value) == false)
                {
                    dict.Add(m.Groups["title"].Value, hostName + m.Groups["href"].Value);
                }
            }

            comicInfo.URLDictionary = dict;
            comicInfo.CoverImgUrl   = regex[5].Match(response).Groups["url"].Value;
            return(comicInfo);
        }
Exemplo n.º 9
0
        public override ComicInfo GetComicInfo(string response)
        {
            Dictionary <string, string> comicDict;
            ComicInfo    comicInfo = new ComicInfo();
            HtmlDocument doc       = new HtmlDocument();

            doc.LoadHtml(response);

            comicDict = new Dictionary <string, string>();
            HtmlNodeCollection nodeCollection = doc.DocumentNode.SelectNodes("//td[@width='20%']/a");

            comicInfo.CoverImgUrl = doc.DocumentNode.SelectSingleNode("//td[@align='center']/img").Attributes["src"].Value;
            comicInfo.Description = doc.DocumentNode.SelectSingleNode("//td[@colspan='3']").InnerText;
            comicInfo.Tag         = doc.DocumentNode.SelectSingleNode("//div[@id='extras']/a").InnerText;

            foreach (HtmlNode tempNode in nodeCollection)
            {
                comicDict.Add(tempNode.InnerText, tempNode.Attributes["href"].Value);
            }

            comicInfo.URLDictionary = comicDict;
            return(comicInfo);
        }
Exemplo n.º 10
0
        public override ComicInfo GetComicInfo(string response)
        {
            HtmlDocument                doc;
            HtmlNodeCollection          tempCollect;
            ComicInfo                   info = new ComicInfo();
            Dictionary <string, string> dict;

            dict = new Dictionary <string, string>();
            doc  = new HtmlDocument();
            doc.LoadHtml(response);

            tempCollect      = doc.DocumentNode.SelectNodes("//dl[@class='mh-detail']/dd/p");
            info.Author      = tempCollect[0].SelectSingleNode("./a").InnerText;
            info.HasFinished = tempCollect[1].SelectSingleNode("./a").InnerText;

            tempCollect      = doc.DocumentNode.SelectNodes("//div[@class='mh-introduce']/p");
            info.Description = AnalyseTool.ReplacePunctuation(tempCollect[1].InnerText);

            tempCollect = doc.DocumentNode.SelectNodes("//ul[@class='b1']");

            foreach (HtmlNode temp in tempCollect)
            {
                HtmlNodeCollection collect = temp.SelectNodes("./li/a");

                foreach (HtmlNode node in collect)
                {
                    if (dict.ContainsKey(node.Attributes["title"].Value) == false)
                    {
                        dict.Add(node.Attributes["title"].Value, node.Attributes["href"].Value);
                    }
                }
            }

            info.URLDictionary = dict;
            return(info);
        }
Exemplo n.º 11
0
        public override ComicInfo GetComicInfo(string response)
        {
            var       url  = "";
            ComicInfo info = new ComicInfo();
            Dictionary <string, string> dict;

            dict = new Dictionary <string, string>();
            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(response);
            HtmlNodeCollection collect = doc.DocumentNode.SelectNodes("//ul[@class='detail']/li");

            info.Author      = collect[0].SelectSingleNode("./a").InnerText;
            info.otherWork   = collect[0].SelectSingleNode("./a").Attributes["href"].Value;
            info.HasFinished = collect[2].InnerText.Replace("状态:", "");
            info.Tag         = collect[3].InnerText.Replace("分类:", "");

            HtmlNode node = doc.DocumentNode.SelectSingleNode("//div[@id='summary']");

            info.Description = doc.DocumentNode.SelectSingleNode("//div[@id='content_wrapper']").InnerText;
            node             = doc.DocumentNode.SelectSingleNode("//div[@class='chapters']/ul");
            collect          = node.SelectNodes("./li/a");

            foreach (HtmlNode temp in collect)
            {
                url = hostName + temp.Attributes["href"].Value;

                if (dict.ContainsKey(temp.InnerText) == false)
                {
                    dict.Add(temp.InnerText, url);
                }
            }

            info.URLDictionary = dict;
            return(info);
        }
Exemplo n.º 12
0
        public virtual ComicInfo GetComicInfo(string rersponse)//获取漫画相关信息
        {
            ComicInfo comicIno = new ComicInfo();

            return(comicIno);
        }
Exemplo n.º 13
0
        public override ComicInfo GetComicInfo(string response)
        {
            HtmlDocument doc;
            ComicInfo    info;

            doc = new HtmlDocument();
            doc.LoadHtml(response);
            info = new ComicInfo();

            Regex              regex   = new Regex(@"pageImage\s*=\s*""(?<url>[\w\.\:/-]*)");
            HtmlNode           node    = doc.DocumentNode.SelectSingleNode("//div[@class='comic-view clearfix']");
            HtmlNodeCollection collect = node.SelectNodes("./div/div/dl[@class='pic_zi fs15']");

            if (collect != null)
            {
                if (collect[4] != null && collect[4].SelectSingleNode("./dd/a") != null)
                {
                    info.Author    = collect[4].SelectSingleNode("./dd/a").InnerText;
                    info.otherWork = collect[4].SelectSingleNode("./dd/a").Attributes["href"].Value;
                }
                else
                {
                    info.Author = "无";
                }

                if (collect[2].SelectSingleNode("./dd") != null)
                {
                    info.HasFinished = collect[2].SelectSingleNode("./dd").InnerText;
                }
                else
                {
                    info.HasFinished = "无";
                }

                if (collect[3].SelectNodes("./dd/a") != null)
                {
                    info.Tag = collect[3].SelectNodes("./dd/a")[0].InnerText;
                }
                else
                {
                    info.Tag = "无";
                }

                if (node.SelectSingleNode("//p[@class='txtDesc autoHeight']") != null)
                {
                    info.Description = node.SelectSingleNode("//p[@class='txtDesc autoHeight']").InnerText.Replace("简介:", "");
                }
            }


            Dictionary <string, string> dict = new Dictionary <string, string>();

            collect = doc.DocumentNode.SelectNodes("//ul[@class='Drama autoHeight']/li");

            if (collect == null)
            {
                info.URLDictionary = dict;
                return(info);
            }

            string name  = "";
            int    count = 1;

            foreach (HtmlNode nodeTemp in collect)
            {
                node = nodeTemp.SelectSingleNode("./a");
                name = node.SelectSingleNode("./span").InnerText;

                if (dict.ContainsKey(name) == false)
                {
                    dict.Add(name, node.Attributes["href"].Value);
                }
            }

            info.URLDictionary = dict;
            return(info);
        }