Пример #1
0
        public List <string[]> GetMovieList()
        {
            List <string[]>             MovieInfo = new List <string[]>();
            Dictionary <string, string> headers   = new Dictionary <string, string>();

            headers.Add("Timeout", "2000");
            headers.Add("ContentType", "application/x-www-form-urlencoded; charset=UTF-8");
            headers.Add("UserAgent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36");

            Request Response_MoviePage = new Request("http://www.gaoqingzy.com/index.php?m=vod-search&wd=" + "奇异博士", headers);
            var     html = Response_MoviePage.GetHtml();

            foreach (var MovieUrl_A in html[0].SelectNodes("//ul[@class='nr']"))
            {
                String  MovieUrl          = "http://www.gaoqingzy.com" + MovieUrl_A.SelectSingleNode(".//a[@class='name']").Attributes["href"].Value;
                Request Response_MovieUrl = new Request(MovieUrl, headers);
                var     html_MovieUrl     = Response_MovieUrl.GetHtml()[0];
                string  MovieName         = html_MovieUrl.SelectSingleNode("//div[@class='vodInfo']//h2[1]").InnerText;
                //这里的标签页从第一行开始
                //var x = html_MovieUrl.SelectSingleNode("//div[@class='vodplayinfo'][1]").InnerText;
                Console.WriteLine(MovieName);
                foreach (var f3 in html_MovieUrl.SelectSingleNode("//div[@style='padding-left:10px;word-break: break-all; word-wrap:break-word;']").SelectNodes(".//li"))
                {
                    int    index        = f3.InnerText.IndexOf("$");
                    string MovieAddress = f3.InnerText.Substring(index + 1, f3.InnerText.Length - index - 1);
                    Console.WriteLine(MovieAddress);
                    MovieInfo.Add(new string[2] {
                        MovieName, MovieAddress
                    });
                }
            }
            return(MovieInfo);
        }
Пример #2
0
 private void SMovie(JToken MovieFindKey)
 {
     try
     {
         Request Response_MoviePage = new Request(MovieFindKey["searchUrl"] + movieName, headers);
         var     html   = Response_MoviePage.GetHtml();
         var     PageMS = html[0].SelectNodes(MovieFindKey["PageListFind"]["PageList"].ToString());
         if (PageMS == null)
         {
             Console.WriteLine(MovieFindKey["title"] + "无该资源"); return;
         }
         foreach (var MovieUrl_A in PageMS)
         {
             String  MovieUrl          = MovieFindKey["baseUrl"] + MovieUrl_A.SelectSingleNode(MovieFindKey["PageListFind"]["MovieAdress"].ToString()).Attributes[MovieFindKey["PageListFind"]["href"].ToString()].Value;
             Request Response_MovieUrl = new Request(MovieUrl, headers);
             var     html_MovieUrl     = Response_MovieUrl.GetHtml()[0];
             string  MovieName         = html_MovieUrl.SelectSingleNode(MovieFindKey["MovieNmae"].ToString()).InnerText;
             Console.WriteLine(MovieName);
             foreach (var f3 in html_MovieUrl.SelectSingleNode(MovieFindKey["MovieListFind"]["MovieList"].ToString()).SelectNodes(MovieFindKey["MovieListFind"]["MovieUrl"].ToString()))
             {
                 int index = f3.InnerText.IndexOf("$");
                 if (index == -1)
                 {
                     continue;
                 }
                 string MovieAddress = f3.InnerText.Substring(index + 1, f3.InnerText.Length - index - 1);
                 Console.WriteLine(MovieFindKey["title"] + "- - - - - -" + MovieAddress);
                 //MovieInfo.Add(new string[2] { MovieName, MovieAddress });
                 MovieList.Add(MovieAddress);
                 MovieNameList.Add(MovieName);
                 BeginInvoke(new Action(() =>
                 {
                     textBox_Info.AppendText("●   编号:" + CountMovie++ + "     电影名:" + MovieName + "      地址:" + MovieAddress + "\r\n");
                     textBox_Info.Update();
                 }), null);
                 if (MovieNameList.Count() > 1000)
                 {
                     return;
                 }
             }
         }
     }
     catch
     {
         BeginInvoke(new Action(() =>
         {
             textBox_Info.AppendText("由于网络问题,暂无资源" + "\r\n");
             textBox_Info.Update();
         }), null);
         Console.WriteLine("网络出错");
     }
     BeginInvoke(new Action(() =>
     {
         textBox_Info.AppendText("------" + MovieFindKey["title"] + ":资源查找结束------" + "\r\n");
     }), null);
 }