Esempio n. 1
0
        /// <summary>
        /// 影片列表获取
        /// </summary>
        /// <param name="urlHome"></param>
        public TitleName GetVideoList(string htmlUrl)
        {
            TitleName titleName = new TitleName();

            if (!htmlUrl.StartsWith("http"))
            {
                htmlUrl = baseStr + htmlUrl;
            }
            HtmlNode htmlNode = GetHtmlDoc(htmlUrl);

            if (htmlNode == null)
            {
                titleName.titleVideos = new List <Video>();
                return(titleName);
            }
            //主页影片列表获取
            string xpathTitle = "//span[@class='xing_vb4']/..";
            var    htmls      = htmlNode.SelectNodes(xpathTitle);

            if (htmls == null)
            {
                return(null);
            }

            List <Video> videos = new List <Video>();

            foreach (var item in htmls)
            {
                Video video = new Video();
                //标识ID
                MatchCollection matchCollection = Regex.Matches(item.SelectSingleNode("./span[@class='xing_vb4']/a").Attributes["href"].Value, "vod-detail-id-([0-9]*).html");
                foreach (Match item1 in matchCollection)
                {
                    video.id = Convert.ToInt32(item1.Groups[1].Value);
                }
                //影片名
                video.videoName = item.SelectSingleNode("./span[@class='xing_vb4']").InnerText.Replace("\r", "").Replace("\n", "").Replace("\t", "").Replace("&nbsp", " ").Trim();
                //封面影片地址
                // video.videoImgUrl = item.SelectSingleNode("./span[@class='xing_vb4']/a").Attributes["href"].Value;
                //影片类型
                video.videoType = item.SelectSingleNode("./span[@class='xing_vb5']").InnerText;
                //if (GreenMode)
                //{
                //    if (video.videoType.Contains("伦理片") || video.videoType.Contains("福利片"))
                //    {
                //        continue;
                //    }
                //}
                //更新时间
                video.videoUpdateTime = item.SelectSingleNode("./span[@class='xing_vb6']|./span[@class='xing_vb7']").InnerText;
                videos.Add(video);
            }
            titleName.titleVideos = videos;
            string szdf = htmlNode.SelectSingleNode("//div[@class='pages']").InnerText;

            titleName.pageCount = " " + Regex.Match(szdf, "当前:(.+?)页").Value;//当前: 1 / 890页
            return(titleName);
        }
Esempio n. 2
0
        /// <summary>
        /// 影片类型
        /// </summary>
        /// <param name="documenthtml"></param>
        /// <returns></returns>
        public List <TitleName> GetVideoType()
        {
            List <TitleName> titleNames = new List <TitleName>();
            HtmlNode         htmlNode   = GetHtmlDoc(baseStr);
            var sd = htmlNode.SelectNodes("//ul[@id='sddm']/li");

            foreach (HtmlNode item in sd)
            {
                try
                {
                    HtmlNode  _a        = item.SelectSingleNode("a");
                    HtmlNode  _div      = item.SelectSingleNode("div");
                    TitleName titleName = GetVideoType(_a);
                    //if (GreenMode)
                    //{
                    //    if (item.InnerText.Contains("福利") || item.InnerText.Contains("伦理"))
                    //    {
                    //        continue;
                    //    }
                    //}
                    if (titleName != null)
                    {
                        titleNames.Add(titleName);
                        if (_div != null)
                        {
                            var _as = _div.SelectNodes("a");
                            if (_as != null && _as.Count > 0)
                            {
                                foreach (HtmlNode items in _as)
                                {
                                    TitleName titleName2 = GetVideoType(items);
                                    if (titleName2 != null)
                                    {
                                        titleNames.Add(titleName2);
                                    }
                                }
                            }
                        }
                    }
                }
                catch { }
            }
            return(titleNames);
        }
Esempio n. 3
0
        /// <summary>
        /// 影片类型
        /// </summary>
        /// <returns></returns>
        public static List <TitleName> GetVideoType(Ok_API dataApi)
        {
            List <TitleName> titles = new List <TitleName>();

            foreach (var item in dataApi.@class)
            {
                //if (removeTitle.Contains(item.type_name)) continue;
                //if (GreenMode)
                //{
                //    if (item.type_name.Contains("福利") || item.type_name.Contains("伦理"))
                //    {
                //        continue;
                //    }
                //}
                TitleName titleName = new TitleName();
                titleName.titleId   = item.type_id;
                titleName.titleType = item.type_name;
                titles.Add(titleName);
            }
            return(titles);
        }
Esempio n. 4
0
        /// <summary>
        /// 影片列表获取
        /// </summary>
        /// <param name="dataApi"></param>
        /// <returns></returns>
        public static TitleName GetVideoList(Ok_API dataApi)
        {
            TitleName    titleName = new TitleName();
            List <Video> videos    = new List <Video>();

            foreach (var item in dataApi.list)
            {
                //if (GreenMode)
                //{
                //    if (item.vod_class.Contains("伦理片") || item.vod_class.Contains("福利片"))
                //    {
                //        continue;
                //    }
                //}
                Video video = new Video();
                video.id                = item.vod_id;
                video.videoName         = item.vod_name;
                video.videoImgUrl       = item.vod_pic;
                video.videoType         = item.vod_class;
                video.videoTotalInfoTxt = item.vod_content;
                video.videoSynopsis     = item.vod_content;
                List <PlayAddress> playAddresses = new List <PlayAddress>();

                //播放地址
                string[] type    = item.vod_play_from.Split(new string[] { "$$$" }, StringSplitOptions.RemoveEmptyEntries);
                string[] typeURL = item.vod_play_url.Split(new string[] { "$$$" }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < type.Length; i++)
                {
                    if (type[i].Contains("m3u8"))
                    {
                        continue;
                    }
                    PlayAddress playAddress = new PlayAddress();
                    playAddress.playType = type[i];
                    if (type[i].Contains("kuyun"))
                    {
                        playAddress.playType = "播放";
                    }
                    List <VideoUrl> videoUrls = new List <VideoUrl>();
                    string[]        urls      = typeURL[i].Split('#');
                    foreach (var item2 in urls)
                    {
                        VideoUrl videoUrl = new VideoUrl();
                        string[] ars      = item2.Split('$');
                        if (ars.Count() == 2)
                        {
                            videoUrl.playName = ars[0] != null ? ars[0] : " ";
                            videoUrl.playURL  = ars[1] != null ? ars[1] : " ";
                        }
                        else
                        {
                            videoUrl.playName = item2;
                            videoUrl.playURL  = item2;
                        }
                        videoUrls.Add(videoUrl);
                    }
                    playAddress.videoUrl = videoUrls;
                    playAddresses.Add(playAddress);
                }
                //下载地址
                PlayAddress playDown = new PlayAddress();
                if (!string.IsNullOrWhiteSpace(item.vod_down_from))
                {
                    playDown.playType = item.vod_down_from;
                    if (item.vod_down_from.Contains("xunlei"))
                    {
                        playDown.playType = "下载";
                    }
                    List <VideoUrl> xunurls = new List <VideoUrl>();
                    string[]        url     = item.vod_down_url.Split('#');
                    foreach (var item2 in url)
                    {
                        VideoUrl videoUrl = new VideoUrl();
                        string[] ars      = item2.Split('$');
                        if (ars.Count() == 2)
                        {
                            videoUrl.playName = ars[0] != null ? ars[0] : " ";
                            videoUrl.playURL  = ars[1] != null ? ars[1] : " ";
                        }
                        else
                        {
                            videoUrl.playName = item2;
                            videoUrl.playURL  = item2;
                        }
                        xunurls.Add(videoUrl);
                    }
                    playDown.videoUrl = xunurls;
                    playAddresses.Add(playDown);
                }

                video.playInformation = playAddresses;
                video.videoUpdateTime = item.vod_time;
                videos.Add(video);
            }
            titleName.titleVideos = videos;
            titleName.pageCount   = dataApi.pagecount;
            return(titleName);
        }