Exemple #1
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);
        }
Exemple #2
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);
        }