Beispiel #1
0
        public static IDModel GetMovieInfor(string url)
        {
            IDModel model = new IDModel();
            string  html  = HtmlHelper.DyDownloadHtml(url);

            if (!string.IsNullOrEmpty(html))
            {
                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(html);
                //获取电影主图
                string   moviePath = "//*[@id='Zoom']/span/td[1]/p[1]/img[1]";
                HtmlNode imageNode = doc.DocumentNode.SelectSingleNode(moviePath);
                if (imageNode != null)
                {
                    model.headImg = imageNode.Attributes["src"].Value;
                }
                //获取电影简介
                // //*[@id='Zoom']/span/p[1]/text()[25]
                string             inforPath = "//*[@id='Zoom']/span/td[1]/p[1]";//"//*[@id='Zoom']/span/p[1]/br[28]";
                HtmlNodeCollection infoNodes = doc.DocumentNode.SelectNodes(inforPath);
                if (infoNodes != null)
                {
                    model.inforMessage = infoNodes[0].InnerText;
                }
                //获取下载路径            //*[@id="Zoom"]/span/td[1]/table/tbody/tr/td/a
                string   downloadPath = "//*[@id='Zoom']/span/td[1]//p[6]/table/tbody/tr/td/a";
                HtmlNode downloadNode = doc.DocumentNode.SelectSingleNode(downloadPath);
                if (downloadNode != null)
                {
                    model.downURL = downloadNode.Attributes["href"].Value;
                }
            }
            return(model);
        }
Beispiel #2
0
        /// <summary>
        /// 查找电影
        /// </summary>
        /// <param name="movieName"></param>
        public void GetMovieInfo(string movieName)
        {
            txt_name.Text         = movieName;
            rtb_xping.Text        = "";
            pic_img.ImageLocation = "http://ojtdqq2ha.bkt.clouddn.com/16b0b3789293bd7ba4e280a228546ef3.jpg";
            gkUrl = "";
            btn_search.Enabled = false;
            //try
            //{
            IDModel movieInfo = ID97Crewl.GetMovieInforMode(movieName);
            IDModel wxMovie   = WXCrewl.GetMovieInfor(movieName);

            if (movieInfo != null && movieInfo.downURL != null)
            {
                rtb_messagebox.Text   = movieInfo.downURL;
                rtb_xping.Text        = movieInfo.inforMessage;
                pic_img.ImageLocation = movieInfo.headImg;
                if (wxMovie != null && wxMovie.downURL != null)
                {
                    gkUrl = wxMovie.downURL;
                }
            }
            else
            {
                if (wxMovie != null && wxMovie.downURL != null)
                {
                    rtb_messagebox.Text   = "无下载资源,点击在线观看!";
                    rtb_xping.Text        = wxMovie.inforMessage;
                    pic_img.ImageLocation = wxMovie.headImg;
                    gkUrl = wxMovie.downURL;
                }
                else
                {
                    rtb_xping.Text        = "";
                    pic_img.ImageLocation = "http://ojtdqq2ha.bkt.clouddn.com/16b0b3789293bd7ba4e280a228546ef3.jpg";
                    gkUrl = "";
                    rtb_messagebox.Text = "暂无资源!";
                }
            }
            //}
            //catch (Exception)
            //{
            //    throw;
            //}

            btn_search.Enabled = true;
        }
Beispiel #3
0
        public static IDModel GetMovieInforMode(string movieName)
        {
            IDModel model = null;
            //搜索页提取
            string html = HtmlHelper.DownloadHtml(HtmlHelper.idSeach + movieName);

            if (!string.IsNullOrEmpty(html))
            {
                model = new IDModel();
                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(html);///html/body/div[7]/div[1]/div/div[1]/a/img
                string   xPath = "/html/body/div/div[1]/div/div[1]/a";
                HtmlNode node  = doc.DocumentNode.SelectSingleNode(xPath);
                if (node != null)
                {
                    string movieUrl    = node.Attributes["href"].Value;
                    string movieId     = movieUrl.Substring(movieUrl.LastIndexOf('/') + 1).Replace(".html", ""); //获取电影编号18094
                    string resquestUrl = HtmlHelper.downloadUrl + movieId;
                    string inforHtml   = HtmlHelper.DownloadHtml(resquestUrl);
                    if (inforHtml != null)
                    {
                        HtmlDocument inforDoc = new HtmlDocument();
                        inforDoc.LoadHtml(inforHtml);  //  //*[@id="normalDown"]/div/table
                        string   downPath = "//*[@id='normalDown']/div/table";
                        HtmlNode downNode = inforDoc.DocumentNode.SelectSingleNode(downPath);
                        if (downNode != null)
                        {
                            HtmlDocument thirdDoc = new HtmlDocument();
                            thirdDoc.LoadHtml(downNode.InnerHtml);
                            string             aPath     = "//a";
                            HtmlNodeCollection aNode     = thirdDoc.DocumentNode.SelectNodes(aPath);
                            string             downInfor = String.Empty;
                            if (aNode != null)
                            {
                                foreach (HtmlNode nodes in aNode)
                                {
                                    if (nodes.Attributes["href"].Value.IndexOf("http://pan.baidu.com/") >= 0 || nodes.Attributes["href"].Value.IndexOf("https://pan.baidu.com/s/") >= 0)
                                    {
                                        downInfor += nodes.Attributes["title"].Value + "\n百度云盘地址:" + nodes.Attributes["href"].Value + "\n";
                                    }
                                    else if (nodes.Attributes["href"].Value.IndexOf("ed2k://|file") >= 0)
                                    {
                                        downInfor += "电驴:" + nodes.Attributes["href"].Value + "\n";
                                    }
                                    else if (nodes.Attributes["href"].Value.IndexOf("magnet:?xt=urn:") >= 0)
                                    {
                                        downInfor += "磁力:" + nodes.Attributes["href"].Value + "\n";
                                    }
                                }
                            }
                            model.downURL = downInfor;
                        }
                    }
                }                 //html/body/div[7]/div[1]/div/div[1]/a/img
                string   imgPath = "/html/body/div/div[1]/div/div[1]/a/img";
                HtmlNode imgNode = doc.DocumentNode.SelectSingleNode(imgPath);
                if (imgNode != null)
                {
                    model.headImg = imgNode.Attributes["src"].Value;
                }
                string   infoPath = "/html/body/div/div[1]/div/div[2]/div/p[2]";
                HtmlNode infoNode = doc.DocumentNode.SelectSingleNode(infoPath);
                if (infoNode != null)
                {
                    model.inforMessage = infoNode.InnerText;
                }
                else
                {
                    infoPath = "/html/body/div[7]/div[1]/div/div[2]/div/p[2]";
                    infoNode = doc.DocumentNode.SelectSingleNode(infoPath);
                    if (infoNode != null)
                    {
                        model.inforMessage = infoNode.InnerText;
                    }
                }
            }
            return(model);
        }
Beispiel #4
0
        public static IDModel GetMovieInfor(string movieName)
        {
            IDModel model     = null;
            string  searchUrl = HtmlHelper.wsSearchUrl + movieName;
            string  html      = HtmlHelper.DownloadHtml(searchUrl);

            if (!string.IsNullOrEmpty(html))
            {
                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(html);
                string   wsMoviePath = "/html/body/div[3]/div[2]/ul/li[1]/a";
                HtmlNode htmlnode    = doc.DocumentNode.SelectSingleNode(wsMoviePath);
                if (htmlnode != null)
                {
                    string apathUrl     = htmlnode.Attributes["href"].Value;
                    string resourceUrl  = HtmlHelper.wsDownloadUrl + apathUrl;
                    string resourceHtml = HtmlHelper.DownloadHtml(resourceUrl);
                    if (!string.IsNullOrEmpty(resourceHtml))
                    {
                        HtmlDocument resourceDoc = new HtmlDocument();
                        resourceDoc.LoadHtml(resourceHtml);
                        model = new IDModel();
                        //收看地址          //*[@id="jisuayun"]/div/ul/li[1]/a  //*[@id="wuxingyun"]/div/ul/li/a
                        string   lookPath = "//*[@id='wuxingyun']/div/ul/li/a";
                        HtmlNode linkNode = resourceDoc.DocumentNode.SelectSingleNode(lookPath);
                        if (linkNode != null)
                        {
                            model.downURL = HtmlHelper.wsDownloadUrl + linkNode.Attributes["href"].Value;
                        }
                        else
                        {
                            lookPath = "//*[@id='jisuayun']/div/ul/li[1]/a";
                            linkNode = resourceDoc.DocumentNode.SelectSingleNode(lookPath);
                            if (linkNode != null)
                            {
                                model.downURL = HtmlHelper.wsDownloadUrl + linkNode.Attributes["href"].Value;
                            }
                            else
                            {
                                lookPath = "//*[@id='mgtv']/div/ul/li/a";
                                linkNode = resourceDoc.DocumentNode.SelectSingleNode(lookPath);
                                if (linkNode != null)
                                {
                                    model.downURL = HtmlHelper.wsDownloadUrl + linkNode.Attributes["href"].Value;
                                }
                            }
                        }
                        //图片地址
                        string   imagePath = "/html/body/div[3]/div[3]/div[4]/div[1]/img";
                        HtmlNode imageNode = resourceDoc.DocumentNode.SelectSingleNode(imagePath);
                        if (imageNode != null)
                        {
                            if (imageNode.Attributes.Contains("data-original"))
                            {
                                model.headImg = imageNode.Attributes["data-original"].Value;
                            }
                            else if (imageNode.Attributes.Contains("original"))
                            {
                                model.headImg = imageNode.Attributes["original"].Value;
                            }
                            else if (imageNode.Attributes.Contains("src"))
                            {
                                model.headImg = imageNode.Attributes["src"].Value;
                            }
                        }
                        //简介
                        string   inforPath = "/html/body/div[3]/div[3]/div[4]/div[2]/div[2]/dl[2]/dd/p";
                        HtmlNode inforNode = resourceDoc.DocumentNode.SelectSingleNode(inforPath);
                        if (inforNode != null)
                        {
                            model.inforMessage = "简介:" + inforNode.InnerHtml;
                        }
                    }
                }
            }
            return(model);
        }