コード例 #1
0
        private void HotComic(string url, PublicThing comicDecoder)
        {
            mainFrame.SelectedPageIndex = 0;
            tabControl1.TabPages.Clear();
            SetGifVisable();

            Task task = new Task(() =>
            {
                try
                {
                    lock (getLock)
                    {
                        var response = AnalyseTool.HttpGet(url);

                        if (response == "")
                        {
                            SetGifHidden();
                            return;
                        }
                        var comicTop = comicDecoder.GetTopComic(response);
                        SetProgressBar(comicTop);
                    }
                }
                catch (Exception ex)
                {
                }
            });

            task.Start();
        }
コード例 #2
0
ファイル: ManHuaRen.cs プロジェクト: liulaojian/ComicDownLoad
        private string GenerateAjax(string response)
        {
            var DM5_CID        = "";
            var DM5_MID        = "";
            var DM5_PAGE       = "";
            var DM5_ViewSign   = "";
            var DM5_ViewSignDt = "";
            var DM5_CURL       = "";
            var ImageCount     = "";
            var retStr         = "";

            DM5_CID        = Regex.Match(response, @"DM5_CID\s*=\s*(?<data>\d+)").Groups["data"].Value;
            DM5_MID        = Regex.Match(response, @"DM5_MID\s*=\s*(?<data>\d+)").Groups["data"].Value;
            DM5_PAGE       = Regex.Match(response, @"DM5_PAGEINDEX\s*=\s*(?<data>\d+)").Groups["data"].Value;
            DM5_ViewSign   = Regex.Match(response, @"DM5_VIEWSIGN\s*=\s*""(?<data>\w+)""").Groups["data"].Value;
            DM5_ViewSignDt = Regex.Match(response, @"DM5_VIEWSIGN_DT\s*=\s*""(?<data>[\w\-\s\:\+\%]*)""").Groups["data"].Value;
            DM5_CURL       = Regex.Match(response, @"DM5_CURL\s*=\s*""(?<data>[\w-/]*)""").Groups["data"].Value;
            ImageCount     = Regex.Match(response, @"DM5_IMAGE_COUNT\s*=\s*(?<data>\d+)").Groups["data"].Value;

            retStr = hostAttach + DM5_CURL + "chapterfun.ashx?cid=" + DM5_CID + "&page=" + DM5_PAGE + "&key=" + ""
                     + "&language=1&gtk=6&_cid=" + DM5_CID + "&_mid=" + DM5_MID + "&_dt=" + DM5_ViewSignDt + "&_sign=" + DM5_ViewSign;

            retStr = AnalyseTool.HttpGet(retStr, hostAttach + DM5_CURL);
            DecodeOne(retStr);
            return(retStr);
        }
コード例 #3
0
        public override DownLoadComic GetDownImageList(string response)
        {
            var           retMsg = "";
            DownLoadComic comic  = new DownLoadComic();

            Regex [] regex = new Regex[4];
            regex[0] = new Regex(@"id=""hdPageCount""\svalue=""(?<count>\d+)""");
            regex[1] = new Regex(@"id=""hdVolID""\svalue=""(?<sid>\d+)""");
            regex[2] = new Regex(@"id=""hdS""\svalue=""(?<hds>\d+)""");
            regex[3] = new Regex(@"id=""hdPageIndex""\svalue=""(?<index>\d+)""");
            var comicCout    = Convert.ToInt32(regex[0].Match(response).Groups["count"].Value);
            var sid          = Convert.ToInt32(regex[1].Match(response).Groups["sid"].Value);
            var s            = Convert.ToInt32(regex[2].Match(response).Groups["hds"].Value);
            var currtntIndex = Convert.ToInt32(regex[3].Match(response).Groups["index"].Value);

            List <string> urlList  = new List <string>();
            List <string> htmlList = new List <string>();
            var           html     = "";

            for (int i = currtntIndex; i < comicCout; i++)
            {
                html = hostAttach + "/" + "cool" + sid + "/" + i.ToString() + ".html?s=" + s;
                htmlList.Add(html);
            }

            foreach (var i in htmlList)
            {
                retMsg = AnalyseTool.HttpGet(i, Encoding.UTF8);
                urlList.Add(GetImageUrl(retMsg));
            }

            comic.ImageList = urlList;
            comic.Count     = urlList.Count;
            return(comic);
        }
コード例 #4
0
        public override CategoryCollect FindComicByCategory(string cateGoryStr)//通过漫画分类获取漫画
        {
            var basicInfo    = new BasicComicInfo();
            var comicCollect = new CategoryCollect();
            var bookList     = AnalyseTool.GetTag(cateGoryStr, @"<div class=""book-list"">", "</div>");

            comicCollect.Count = 0;

            Regex regex      = new Regex(@"href=""(?<href>[/\w]*)""\stitle=""(?<title>[\w\&!!,s]*)""><img\s*(data-src|src)=""(?<url>[:\w./]*)""");
            var   comicQueue = new Queue <BasicComicInfo>();

            foreach (Match i in regex.Matches(bookList))
            {
                basicInfo             = new BasicComicInfo();
                basicInfo.ComicHref   = host + i.Groups["href"].Value;
                basicInfo.ComicName   = i.Groups["title"].Value;
                basicInfo.ComicImgUrl = i.Groups["url"].Value;
                comicQueue.Enqueue(basicInfo);
            }


            var pageInfo = AnalyseTool.GetTag(cateGoryStr, @"<div class=""pager-cont"">", "</div>");

            regex = new Regex(@"href=""(?<href>[/\w._]*)""\s*\w+=""[\w-:;]*"">下一页");
            comicCollect.NextPageUrl = homePage + regex.Match(cateGoryStr).Groups["href"].Value;
            comicCollect.Count       = comicQueue.Count;
            comicCollect.ComicQueue  = comicQueue;
            return(comicCollect);
        }
コード例 #5
0
        public override Queue <BasicComicInfo> GetTopComic(string response)
        {
            Queue <BasicComicInfo> comicQueue;
            BasicComicInfo         basic;

            comicQueue = new Queue <BasicComicInfo>();
            response   = AnalyseTool.GetTag(response, @"<div class=""cmt-cont cf""", "</div>");
            var             pattern      = @"href=""(?<href>[/\w]*)""\s*title=""(?<title>[\w\s;!♀♂&【】&]*)""><img\s*(src|data-src)=""(?<url>[:\w/.]*)""";
            Regex           regex        = new Regex(pattern);
            MatchCollection matchCollect = regex.Matches(response);

            var count = 0;

            foreach (Match i in matchCollect)
            {
                basic             = new BasicComicInfo();
                basic.ComicName   = i.Groups["title"].Value;
                basic.ComicImgUrl = i.Groups["url"].Value;
                basic.ComicHref   = host + i.Groups["href"].Value;
                comicQueue.Enqueue(basic);
                count++;
            }

            return(comicQueue);
        }
コード例 #6
0
        private void DecodeCategory(string listUrl)//解析每一栏的标签页
        {
            Task task = new Task(() =>
            {
                var msg           = AnalyseTool.HttpGet(listUrl);
                decoder           = DecoderDistrution.GiveDecoder(listUrl);
                decoder.BackUrl   = listUrl;
                var cateCollect   = decoder.FindComicByCategory(msg);
                resource.NextPage = cateCollect.NextPageUrl;
                resource.LastPage = cateCollect.LastPageUrl;

                progressBar1.Invoke(new Action(() =>
                {
                    progressBar1.Value   = 0;
                    progressBar1.Maximum = cateCollect.ComicQueue.Count;
                    resultListView.Items.Clear();
                }));

                ViewStruct view = new ViewStruct();
                view.Queue      = cateCollect.ComicQueue;
                view.ViewAdd    = resultListView;

                if (m_exitLoad == false)
                {
                    m_exitLoad = true;
                }

                getThread = new Thread(new ParameterizedThreadStart(GetImagesList));
                getThread.Start(view);
            });

            task.Start();
        }
コード例 #7
0
ファイル: HanHanManhua.cs プロジェクト: schyjxy/ComicDownLoad
        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;
        }
コード例 #8
0
        private void FenLei(string url, PublicThing comicDecoder)//通用分类方法
        {
            var count = 0;

            DevExpress.XtraTab.XtraTabPage tab;
            mainFrame.SelectedPageIndex = 0;

            Task task = new Task(() =>
            {
                try
                {
                    lock (getLock)
                    {
                        var response = AnalyseTool.HttpGet(url);

                        if (response == "")
                        {
                            MessageBox.Show("加载图片失败");
                            return;
                        }

                        tabControl1.Invoke(new Action(() =>
                        {
                            var cateInfo = comicDecoder.GiveCategoryInfo(response);
                            tabControl1.TabPages.Clear();
                            resource.CategoryCollect = cateInfo.ComicList;

                            foreach (var i in cateInfo.ComicList)
                            {
                                tab      = new DevExpress.XtraTab.XtraTabPage();
                                tab.Text = i.Key;
                                tabControl1.TabPages.Add(tab);

                                if (count++ > 15)
                                {
                                    break;
                                }
                            }
                        }));

                        if (resource.CategoryCollect.Count > 0)
                        {
                            var key = "";

                            foreach (var i in resource.CategoryCollect)
                            {
                                key = i.Key;
                                break;
                            }
                        }
                    }
                }
                catch
                {
                }
            });

            task.Start();
        }
コード例 #9
0
        public void GetImagesList(object b)//获取批量图片
        {
            var                    count    = 0;
            var                    comicDic = new Dictionary <string, string>();
            Image                  image    = null;
            ViewStruct             view     = (ViewStruct)b;
            Queue <BasicComicInfo> queue    = view.Queue;
            ProcessbarDelegate     progress = new ProcessbarDelegate(AddProgress);
            AddListViewItem        addItem  = new AddListViewItem(ListViewItemAdd);
            ListViewItem           item     = null;

            lock (objLock)
            {
                this.Invoke(new Action(() =>
                {
                    m_exitLoad = false;
                    resultListView.Items.Clear();
                    showImageList.Images.Clear();
                    view.ViewAdd.LargeImageList = showImageList;
                }));

                foreach (var i in queue)
                {
                    if (m_exitLoad == false)
                    {
                        progressBar1.Invoke(progress, progressBar1);
                        image           = AnalyseTool.GetImage(i.ComicImgUrl);
                        item            = new ListViewItem();
                        item.Text       = i.ComicName;
                        item.ImageIndex = count++;
                        // Console.WriteLine("漫画名字:{0},图片索引:{1}", item.Text, item.ImageIndex);
                        this.Invoke(addItem, item, image, view.ViewAdd);

                        if (comicDic.ContainsKey(i.ComicName) == false)
                        {
                            comicDic.Add(i.ComicName, i.ComicHref);
                        }

                        resourse.SearchResultURL = comicDic;
                    }
                    else
                    {
                        count      = 0;
                        m_exitLoad = true;
                        return;
                    }
                }

                m_exitLoad = true;
                runGif.Invoke(new Action(() =>
                {
                    runGif.Visible = false;
                }));
            }
        }
コード例 #10
0
ファイル: DownTask.cs プロジェクト: schyjxy/ComicDownLoad
        public void GetNetComic(DownLoadFile downFile)
        {
            Task task = new Task(() =>
            {
                FileStream file;
                var path           = "";
                var decoder        = DecoderDistrution.GiveDecoder(downFile.ComicUrl);
                var response       = AnalyseTool.HttpGet(downFile.ComicUrl);
                decoder.currentUrl = downFile.ComicUrl;
                var ds             = decoder.GetDownImageList(response);
                path = DownLoadPath + "\\" + ComicName + "\\";

                if (File.Exists(path) == false)
                {
                    Directory.CreateDirectory(path);
                }

                int errorCount = 0;
                int read       = 0;
                int count      = 0;

                foreach (var i in ds.ImageList)
                {
                    file       = new FileStream(path + (count++) + ".jpg", FileMode.Create);
                    var stream = DownLoad(i, SourceUrl);

                    while (stream == null && errorCount < 3)
                    {
                        Thread.Sleep(100);
                        stream = DownLoad(i, SourceUrl);
                        errorCount++;
                    }

                    byte[] buffer = new byte[32768];

                    while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)
                    {
                        file.Write(buffer, 0, read);
                    }

                    if (addFileEvent != null)
                    {
                        addFileEvent(this, file.Name);
                    }

                    file.Flush();
                    stream.Flush();
                    file.Close();
                    stream.Close();
                }
            });

            task.Start();
        }
コード例 #11
0
        private void searchBtn_Click(object sender, EventArgs e)
        {
            var response = "";
            var url      = "";
            var name     = "";

            if (searchControl.Text == "")
            {
                return;
            }

            var keyWord = HttpUtility.UrlEncode(searchControl.Text, Encoding.UTF8);

            foreach (RadioButton r in flowControl.Controls)
            {
                if (r.Checked)
                {
                    name = r.Name;
                    break;
                }
            }

            SetGifVisable();

            Task task = new Task(() =>
            {
                lock (getLock)
                {
                    switch (name)
                    {
                    case "hanhanCheck": url = "http://www.hhimm.com/comic/?act=search&st=" + keyWord; break;

                    case "manhuarenCheck": url = "http://www.1kkk.com/search?title=" + keyWord; break;

                    case "k886Check": url = "https://www.k886.net/search-index?searchType=1&q=" + keyWord; break;

                    case "jiulingCheck": url = "http://m.90mh.com/search/?keywords=" + keyWord; break;

                    case "veryDmCheck": url = "http://www.veryimapp.com/index.php?r=comic%2Fsearch&keyword=" + keyWord; break;

                    case "manhuaduiCheck": url = "https://www.manhuadui.com/search/?keywords=" + keyWord; break;

                    case "mangebzCheck": url = "http://www.mangabz.com/search?title=" + keyWord; break;
                    }

                    response = AnalyseTool.HttpGet(url);
                    decoder  = DecoderDistrution.GiveDecoder(url);
                    SearchComic(response);
                }
            });

            task.Start();
        }
コード例 #12
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);
        }
コード例 #13
0
        private List <string> GenerateImage(string response)
        {
            var DM5_CID        = "";
            var DM5_MID        = "";
            var DM5_PAGE       = "";
            var DM5_ViewSign   = "";
            var DM5_ViewSignDt = "";
            var DM5_CURL       = "";
            var ImageCount     = "";
            var retStr         = "";

            List <string> dataList;

            dataList = new List <string>();

            DM5_CURL = Regex.Match(response, @"DM5_CURL\s*=\s*""(?<data>[\w-/]*)""").Groups["data"].Value;
            var nextPageUrl = hostAttach + DM5_CURL.Substring(0, DM5_CURL.LastIndexOf("/")) + "-p2";

            DM5_CURL       = Regex.Match(response, @"DM5_CURL\s*=\s*""(?<data>[\w-/]*)""").Groups["data"].Value;
            DM5_CID        = Regex.Match(response, @"DM5_CID\s*=\s*(?<data>\d+)").Groups["data"].Value;
            DM5_MID        = Regex.Match(response, @"DM5_MID\s*=\s*(?<data>\d+)").Groups["data"].Value;
            DM5_PAGE       = Regex.Match(response, @"DM5_PAGEINDEX\s*=\s*(?<data>\d+)").Groups["data"].Value;
            DM5_ViewSign   = Regex.Match(response, @"DM5_VIEWSIGN\s*=\s*""(?<data>\w+)""").Groups["data"].Value;
            DM5_ViewSignDt = Regex.Match(response, @"DM5_VIEWSIGN_DT\s*=\s*""(?<data>[\w\-\s\:\+\%]*)""").Groups["data"].Value;
            DM5_ViewSignDt = System.Web.HttpUtility.UrlEncode(DM5_ViewSignDt, System.Text.Encoding.UTF8);
            ImageCount     = Regex.Match(response, @"DM5_IMAGE_COUNT\s*=\s*(?<data>\d+)").Groups["data"].Value;

            var nextDir = DM5_CURL;
            var jsUrl   = hostAttach + nextDir + "chapterfun.ashx?cid=" + DM5_CID + "&page=" + DM5_PAGE + "&key=" + ""
                          + "&language=1&gtk=6&_cid=" + DM5_CID + "&_mid=" + DM5_MID + "&_dt=" + DM5_ViewSignDt + "&_sign=" + DM5_ViewSign;

            retStr = AnalyseTool.HttpGet(jsUrl);

            if (retStr == "")
            {
                return(null);
            }

            int total = Convert.ToInt32(ImageCount);

            dataList = DecodeOne(retStr);

            if (dataList.Count < Convert.ToInt32(ImageCount))
            {
                response = AnalyseTool.HttpGet(nextPageUrl);
                dataList.AddRange(GenerateImage(response));
            }
            return(dataList);
        }
コード例 #14
0
        public void GetImagesList(object b)//获取批量图片
        {
            var                    count    = 0;
            Image                  image    = null;
            ViewStruct             view     = (ViewStruct)b;
            Queue <BasicComicInfo> queue    = view.Queue;
            ProcessbarDelegate     progress = new ProcessbarDelegate(AddProgress);
            AddListViewItem        addItem  = new AddListViewItem(ListViewItemAdd);
            ListViewItemInfo       item     = null;

            lock (getLock)
            {
                this.Invoke(new Action(() =>
                {
                    m_exitLoad = false;
                    resultListView.Items.Clear();
                    showImageList.Images.Clear();
                    view.ViewAdd.LargeImageList = showImageList;
                }));

                DateTime time = DateTime.Now;

                foreach (var i in queue)
                {
                    if (m_exitLoad == false)
                    {
                        progressBar1.Invoke(progress, progressBar1);
                        image           = AnalyseTool.GetImage(i.ComicImgUrl);
                        item            = new ListViewItemInfo();
                        item.Text       = i.ComicName;
                        item.ImageIndex = count++;
                        item.ReferUrl   = i.ComicHref;
                        this.Invoke(addItem, item, image, view.ViewAdd);
                    }
                    else
                    {
                        count      = 0;
                        m_exitLoad = true;
                        SetGifHidden();
                        return;
                    }
                }

                m_exitLoad = true;
                SetGifHidden();
            }
        }
コード例 #15
0
        private string GetDomain()
        {
            string serverUrl = "";
            string configUrl = "http://www.90mh.com/js/config.js";
            string response  = AnalyseTool.HttpGet(configUrl);

            if (response == null)
            {
                serverUrl = "http://img.zzszs.com.cn";
            }

            string temp = response.Substring(response.IndexOf("domain"));

            temp      = temp.Substring(temp.IndexOf("[") + 1, temp.IndexOf("]") - temp.IndexOf("[") - 1);
            serverUrl = temp.Replace("\"", "");
            return(serverUrl);
        }
コード例 #16
0
ファイル: JingMingYan.cs プロジェクト: schyjxy/ComicDownLoad
        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);
        }
コード例 #17
0
        private void searchBtn_Click(object sender, EventArgs e)
        {
            var response = "";
            var url      = "";
            var name     = "";
            var keyWord  = HttpUtility.UrlEncode(searchControl.Text, Encoding.UTF8);

            RadioButton[] radio = { k886Check, kanCheck, hanhanCheck, jingmingyanCheck };

            foreach (RadioButton r in radio)
            {
                if (r.Checked)
                {
                    name = r.Name;
                    break;
                }
            }

            Task task = new Task(() =>
            {
                switch (name)
                {
                case "hanhanCheck": url = "http://www.hhmmoo.com/comic/?act=search&st=" + keyWord; break;

                //case "jingmingyanCheck": url = "http://www.jmydm.com/comic/s.aspx"; response = AnalyseTool.PostWebRequest(url, "tbSTxt=" + keyWord);break;
                case "kanCheck": url = "http://www.manhuagui.com/s/" + keyWord + ".html"; break;

                case "k886Check": url = "https://www.k886.net/search-index?searchType=1&q=" + keyWord; break;
                }

                response = AnalyseTool.HttpGet(url);
                decoder  = DecoderDistrution.GiveDecoder(url);
                SearchComic(response);
            });

            task.Start();
        }
コード例 #18
0
ファイル: JingMingYan.cs プロジェクト: schyjxy/ComicDownLoad
        public override CategoryCollect FindComicByCategory(string cateGoryStr)
        {
            CategoryCollect cateCollect = new CategoryCollect();
            var             dat         = AnalyseTool.GetTag(cateGoryStr, @"<div class=""cComicList""", @"<div class=""cComicPageChange2");
            Regex           regex       = new Regex(@"href=['""](?<href>[/\w-]*)['""]\s*class=['""][\w_]*['""]\stitle=['""](?<title>[\w-!!\s,。]*)['""]><img\salt=['""][\w-!,。\s,]*['""]\s*src=['""](?<url>[\w:/.-]*)");
            var             basicInfo   = new BasicComicInfo();
            var             comicQueue  = new Queue <BasicComicInfo>();

            foreach (Match i in regex.Matches(dat))
            {
                basicInfo             = new BasicComicInfo();
                basicInfo.ComicHref   = hostName + i.Groups["href"].Value;
                basicInfo.ComicName   = i.Groups["title"].Value;
                basicInfo.ComicImgUrl = i.Groups["url"].Value;
                comicQueue.Enqueue(basicInfo);
            }

            dat   = AnalyseTool.GetTag(cateGoryStr, "<span class='cPageChangeLink'>", "</span>");
            regex = new Regex(@"<a\s*href='(?<url>[\w-/]*)'>下一页");
            cateCollect.NextPageUrl     = hostName + regex.Match(dat).Groups["url"].Value;
            cateCollect.ComicQueue      = comicQueue;
            cateCollect.PagesCollection = new Dictionary <string, string>();
            return(cateCollect);
        }
コード例 #19
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);
        }
コード例 #20
0
        private void HotComic(string url, PublicThing comicDecoder)
        {
            mainFrame.SelectedPageIndex = 0;
            tabControl1.TabPages.Clear();
            runGif.Visible = true;

            Task task = new Task(() =>
            {
                var response = AnalyseTool.HttpGet(url);

                if (response == "")
                {
                    runGif.Invoke(new Action(() =>
                    {
                        runGif.Visible = false;
                    }));
                    return;
                }
                var comicTop = comicDecoder.GetTopComic(response);
                SetProgressBar(comicTop);
            });

            task.Start();
        }
コード例 #21
0
ファイル: MangaBz.cs プロジェクト: schyjxy/ComicDownLoad
        public override DownLoadComic GetDownImageList(string response)
        {
            DownLoadComic downLoad   = new DownLoadComic();
            Regex         urlRegex   = new Regex(@"MANGABZ_CURL\s*=\s*""(?<data>[\w/]*)""");
            Regex         midRegex   = new Regex(@"MANGABZ_MID\s*=\s*(?<data>\d+)");
            Regex         cidRegex   = new Regex(@"MANGABZ_CID=(?<data>\d+)");
            Regex         signRegex  = new Regex(@"MANGABZ_VIEWSIGN=""(?<data>\w+)""");
            Regex         dtRegex    = new Regex(@"MANGABZ_VIEWSIGN_DT=""(?<data>[\w\s\-\:]*)""");
            Regex         countRegex = new Regex(@"MANGABZ_IMAGE_COUNT\s*=\s*(?<data>\d+)");

            var url   = "";
            var mid   = "";
            var cid   = "";
            var sign  = "";
            var dt    = "";
            var count = Convert.ToInt32(countRegex.Match(response).Groups["data"].Value);

            var           requestUrl = "";
            string        temp       = "";
            List <string> urlList    = new List <string>();

            urlList.Add(currentUrl);

            for (int i = 1; i < count + 1; i++)
            {
                temp = currentUrl + "#ipg" + i;
                urlList.Add(temp);
            }

            int pos = 1;

            downLoad.ImageList = new List <string>();

            for (int i = 0; i < urlList.Count; i++)
            {
                response = AnalyseTool.HttpGet(urlList[i]);
                url      = urlRegex.Match(response).Groups["data"].Value;
                mid      = midRegex.Match(response).Groups["data"].Value;
                cid      = cidRegex.Match(response).Groups["data"].Value;
                sign     = signRegex.Match(response).Groups["data"].Value;

                requestUrl = host + string.Format("{0}chapterimage.ashx?cid={1}&page={2}&key=&" +
                                                  "_cid={1}&_mid={3}&_dt={4}&sign={5}", url, cid, pos++, mid, System.Web.HttpUtility.UrlEncode(dt), sign);

                var msg = AnalyseTool.HttpGet(requestUrl, currentUrl);

                if (msg == "")
                {
                    msg = AnalyseTool.HttpGet(requestUrl, currentUrl);
                }

                url = urlRegex.Match(response).Groups["data"].Value;

                if (msg != null && msg.Length > 0)
                {
                    Microsoft.JScript.ArrayObject obj = AnalyseTool.EvalJScript(msg);
                    int len = Convert.ToInt32(obj.length);

                    for (int k = 0; k < len; k++)
                    {
                        string imgUrl = obj[k].ToString();

                        if (downLoad.ImageList.Exists(o => o == imgUrl) == false)
                        {
                            downLoad.ImageList.Add(imgUrl);
                        }
                    }
                }
            }

            downLoad.Count = downLoad.ImageList.Count;
            return(downLoad);
        }
コード例 #22
0
        private void FillComicInfo(ListView selectView)
        {
            int x       = 0;
            int y       = 0;
            var receive = "";

            mainFrame.SelectedPageIndex = 1;
            comicNameLabel.Text         = "漫画名:" + selectView.SelectedItems[0].Text;
            var url = resourse.SearchResultURL[selectView.SelectedItems[0].Text];

            resourse.ComicName = selectView.SelectedItems[0].Text;
            resourse.ComicHref = url;
            decoder            = DecoderDistrution.GiveDecoder(url);
            receive            = AnalyseTool.HttpGet(url);

            if (receive == "")
            {
                MessageBox.Show("网络错误,获取失败");
                return;
            }
            var comicInfo = decoder.GetComicInfo(receive);

            downUrlDic        = new Dictionary <string, string>();//存储当前漫画所有图片链接
            downUrlDic        = comicInfo.URLDictionary;
            comicPicBox.Image = showImageList.Images[selectView.SelectedItems[0].Index];
            authorLab.Text    = (comicInfo.Author == null || comicInfo.Author.Length == 0)? "略":comicInfo.Author;
            tagLabe.Text      = "标签:  " + comicInfo.Tag;
            descLable.Text    = "简介:" + comicInfo.Description;
            statusLab.Text    = "连载状态:" + comicInfo.HasFinished;
            CheckBox check;

            checkPanel.Controls.Clear();

            Task task = new Task(() =>
            {
                foreach (var i in comicInfo.URLDictionary)
                {
                    check          = new CheckBox();
                    check.AutoSize = true;
                    check.Text     = i.Key;
                    check.Location = new Point(x, y);

                    this.Invoke(new Action(() =>
                    {
                        checkPanel.Controls.Add(check);
                    }));


                    if (x + check.Width + 5 > checkPanel.Width - check.Width - 10)//如果
                    {
                        x = 0;
                        y = y + check.Height + 20;
                    }
                    else
                    {
                        x = x + check.Width + 5;
                    }
                }
            });

            task.Start();
        }
コード例 #23
0
        private void StartNewDownLoad(List <DownLoadFile> downloadFile, PublicThing decoder)//开始全新下载
        {
            var fullPath = "";

            downlistCollection = new List <DownListBox>();

            try
            {
                Task task = new Task(() =>
                {
                    DownListBox downlist = null;

                    foreach (var i in downloadFile)
                    {
                        DownTask downTask = new DownTask();
                        var url           = i.ComicUrl;
                        var response      = AnalyseTool.HttpGet(url);
                        var down          = decoder.GetDownImageList(response);//解析图片真实地址

                        if (filePanel.InvokeRequired)
                        {
                            this.Invoke(new Action(() =>
                            {
                                downlist          = new DownListBox();
                                downTask.ReferUrl = url;
                                downlist.SetMaxPage(down.ImageList.Count); //下载最大值
                                downlist.Title    = i.ComicName;           //漫画名字
                                downlist.Location = new Point(0, panelPos);
                                downlist.Pages    = down.ImageList.Count;
                                filePanel.Controls.Add(downlist);
                            }));
                        }

                        downlistCollection.Add(downlist);                //添加到控件集合
                        downTask.ComicName            = i.ComicName;
                        downTask.downLoadOneFinished += DownOneFinsihed; //下载完成一个图片
                        downTask.downFinished        += DownAllFinished;
                        downTask.downPaused          += DownPause;
                        downTask.ImageFiles           = down.ImageList;

                        if (File.Exists(i.SavePath) == false)
                        {
                            fullPath = i.SavePath + i.ComicName + "\\";
                            Directory.CreateDirectory(i.SavePath + i.ComicName + "\\");
                        }

                        downlist.FilePath     = fullPath;
                        downTask.DownLoadPath = fullPath;
                        time = DateTime.Now;
                        downTask.DownLoadStart();
                        panelPos = panelPos + downlist.Height;
                    }
                });

                task.Start();
            }
            catch (Exception ex)
            {
                Console.WriteLine("开始下载出错:{0}", ex.Message);
            }
        }
コード例 #24
0
ファイル: DownLoadForm.cs プロジェクト: schyjxy/ComicDownLoad
        private void StartNewDownLoad(List <DownLoadFile> downloadFile, PublicThing decoder, int startIndex = 0)//开始全新下载
        {
            var fullPath = "";

            try
            {
                Task task = new Task(() =>
                {
                    DownListBox downItem = null;
                    List <DownListBox> downList;
                    downList = new List <DownListBox>();
                    ShowBallTip("正在解析,请稍等!", "提示");

                    foreach (var i in downloadFile)
                    {
                        DownTask downTask  = new DownTask();
                        var url            = i.ComicUrl;
                        var response       = AnalyseTool.HttpGet(url, url);
                        decoder.currentUrl = url;

                        if (response == "")
                        {
                            MessageBox.Show("下载时获取网页错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        var down = decoder.GetDownImageList(response);//解析图片真实地址

                        if (down == null || down.ImageList == null || down.Count == 0)
                        {
                            MessageBox.Show("获取网页数据失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        this.Invoke(new Action(() =>
                        {
                            downItem                      = SearchDownListBox(i.ComicName);
                            downTask.SourceUrl            = url;
                            downItem.deleteEvent         += downItem_deleteEvent;
                            downItem.resumeDownLoadEvent += downItem_resumeDownLoadEvent;
                            downItem.SetMaxPage(down.ImageList.Count); //下载最大值
                            downItem.Title = i.ComicName;              //漫画名字
                            downItem.Pages = down.ImageList.Count;
                            filePanel.Controls.Add(downItem);
                        }));


                        if (downlistCollection.Contains(downItem) == false)
                        {
                            downlistCollection.Add(downItem);//添加到控件集合
                        }
                        downTask.ComicName            = i.ComicName;
                        downTask.downLoadOneFinished += DownOnePicFinsihed;//下载完成一个图片
                        downTask.downFinished        += DownAllFinished;
                        downTask.downPaused          += DownPause;
                        downTask.ImageFiles           = down.ImageList;

                        if (File.Exists(i.SavePath) == false)
                        {
                            fullPath = i.SavePath + "\\" + i.ComicName + "\\";
                            Directory.CreateDirectory(i.SavePath + "\\" + i.ComicName + "\\");
                        }

                        downItem.FilePath     = fullPath;
                        downTask.DownLoadPath = fullPath;
                        downTask.DownLoadStart(startIndex);
                        taskQueue.Add(downTask);
                        AddDownRecord(downTask.ComicName, downTask.SourceUrl, downTask.DownLoadPath, downTask.ImageFiles.Count, 0, 0);//添加记录到数据库
                        downList.Add(downItem);
                    }

                    ShowBallTip("解析完成,开始下载!", "提示");
                });

                task.Start();
            }
            catch (Exception ex)
            {
                Console.WriteLine("开始下载出错:{0}", ex.Message);
            }
        }
コード例 #25
0
        private void FillComicInfo(ListView selectView)
        {
            var receive = "";
            var url     = "";

            if (selectView.SelectedItems == null)
            {
                return;
            }

            ListViewItemInfo item = null;

            this.Invoke(new Action(() =>
            {
                item = selectView.SelectedItems[0] as ListViewItemInfo;
                mainFrame.SelectedPageIndex = 1;
                comicNameLabel.Text         = "漫画名:" + item.Text;
                comicPicBox.Image           = showImageList.Images[selectView.SelectedItems[0].Index];
                url = item.ReferUrl;
                resource.ComicName = item.Text;
                resource.ComicHref = url;
                currentItem        = item;
            }));

            //ShowWait(checkPanel);
            decoder = DecoderDistrution.GiveDecoder(url);
            receive = AnalyseTool.HttpGet(url);
            //RemoveWait(checkPanel);

            if (receive == "")
            {
                MessageBox.Show("网络错误,获取失败");
                return;
            }

            var comicInfo = decoder.GetComicInfo(receive);

            item.UrlDictronary = comicInfo.URLDictionary;

            this.Invoke(new Action(() =>
            {
                authorLab.Text = (comicInfo.Author == null || comicInfo.Author.Length == 0) ? "略" : comicInfo.Author;
                tagLabe.Text   = "标签:  " + comicInfo.Tag;
                descLable.Text = "简介:" + comicInfo.Description;
                statusLab.Text = "连载状态:" + comicInfo.HasFinished;
                checkPanel.Controls.Clear();

                if (comicInfo.URLDictionary == null)
                {
                    descLable.Text = "简介:" + "该漫画已经下架!";
                    return;
                }

                List <Controls.CheckBoxEx> list = new List <Controls.CheckBoxEx>();

                foreach (var i in comicInfo.URLDictionary)
                {
                    var checkBox  = new Controls.CheckBoxEx();
                    checkBox.Text = i.Key;
                    list.Add(checkBox);
                }
                checkPanel.Controls.AddRange(list.ToArray());
                SetGifHidden();
            }));
        }
コード例 #26
0
        public override DownLoadComic GetDownImageList(string response)//遍历,需要优化
        {
            int           total = 0;
            HtmlDocument  doc   = new HtmlDocument();
            DownLoadComic comic = new DownLoadComic();

            if (response == "")
            {
                return(comic);
            }

            doc.LoadHtml(response);
            HtmlNode           node    = doc.DocumentNode.SelectSingleNode("//span[@id='k_total']");
            HtmlNodeCollection collect = doc.DocumentNode.SelectNodes("//div[@class='UnderPage']/div");

            string html     = "";
            string htmlData = "";
            string nextPage = "";

            string baseHtml = collect[2].SelectSingleNode("./mip-link").Attributes["href"].Value;

            if (baseHtml.Contains("-"))
            {
                html = baseHtml.Substring(0, baseHtml.LastIndexOf("-"));
            }
            else
            {
                html = baseHtml;
            }

            total = Convert.ToInt32(node.InnerText);
            List <string> list   = new List <string>();
            string        imgUrl = collect[2].SelectSingleNode("./mip-link/mip-img").Attributes["src"].Value;

            list.Add(imgUrl);

            DateTime time = DateTime.Now;

            List <string> urlList = new List <string>();

            for (int i = 2; i < total + 1; i++)
            {
                nextPage = html + "-" + i + ".html";
                urlList.Add(nextPage);
            }

            string[] responseArry = AnalyseTool.HttpGet(urlList.ToArray());
            Console.WriteLine("获取所有访问耗时ms:{0}", DateTime.Now.Subtract(time).TotalMilliseconds);

            foreach (var i in responseArry)
            {
                if (i == "")
                {
                    return(comic);
                }
                doc.LoadHtml(i);
                list.Add(doc.DocumentNode.SelectSingleNode("//mip-img").Attributes["src"].Value);
            }

            comic.ImageList = list;
            comic.Count     = list.Count;
            return(comic);
        }
コード例 #27
0
        public override DownLoadComic GetDownImageList(string response)
        {
            string             nextHtml = "";
            List <string>      imageList;
            HtmlDocument       doc;
            HtmlNode           node;
            HtmlNodeCollection nodeCollect;
            DownLoadComic      comic;

            doc = new HtmlDocument();
            doc.LoadHtml(response);
            comic     = new DownLoadComic();
            imageList = new List <string>();

            try
            {
                nodeCollect = doc.DocumentNode.SelectNodes("//img");
                node        = doc.DocumentNode.SelectSingleNode("//input[@id='total']");
                var total = Convert.ToInt32(node.Attributes["value"].Value);

                node = doc.DocumentNode.SelectSingleNode("//input[@id='pos']");
                var pos = Convert.ToInt32(node.Attributes["value"].Value) + 1;
                var cid = Convert.ToInt32(doc.DocumentNode.SelectSingleNode("//input[@id='cid']").Attributes["value"].Value);
                var id  = Convert.ToInt32(doc.DocumentNode.SelectSingleNode("//input[@id='id']").Attributes["value"].Value);

                nextHtml = hostName + "/index-look-cid-" + cid.ToString() + "-id-" + id.ToString() + "-p-" + pos.ToString();

                if (nodeCollect != null && nodeCollect.Count >= 2)
                {
                    imageList = FillImageList(nodeCollect[0].Attributes["src"].Value, nodeCollect[1].Attributes["src"].Value, total);

                    if (imageList.Count == total)
                    {
                        comic.Count     = imageList.Count;
                        comic.ImageList = imageList;
                        return(comic);
                    }
                }

                foreach (HtmlNode temp in nodeCollect)
                {
                    imageList.Add(temp.Attributes["src"].Value);
                }

                for (int i = 0; i < total; i++)
                {
                    response = AnalyseTool.HttpGet(nextHtml, Encoding.UTF8);
                    doc.LoadHtml(response);
                    node        = doc.DocumentNode.SelectSingleNode("//input[@id='pos']");
                    pos         = Convert.ToInt32(node.Attributes["value"].Value) + 1;
                    cid         = Convert.ToInt32(doc.DocumentNode.SelectSingleNode("//input[@id='cid']").Attributes["value"].Value);
                    id          = Convert.ToInt32(doc.DocumentNode.SelectSingleNode("//input[@id='id']").Attributes["value"].Value);
                    nextHtml    = hostName + "/index-look-cid-" + cid.ToString() + "-id-" + id.ToString() + "-p-" + pos.ToString();
                    nodeCollect = doc.DocumentNode.SelectNodes("//img");

                    foreach (HtmlNode temp in nodeCollect)
                    {
                        if (imageList.Contains(temp.Attributes["src"].Value) == false)
                        {
                            imageList.Add(temp.Attributes["src"].Value);
                        }
                    }

                    if (imageList.Count >= total || pos == total)
                    {
                        break;
                    }
                }

                comic.Count     = imageList.Count;
                comic.ImageList = imageList;
            }
            catch (Exception ex)
            {
                Console.WriteLine("KanManHua{0}.GetDownImageList,原因:{1}", ex.Message);
            }
            return(comic);
        }