Esempio n. 1
0
        public static IEnumerable <Video> Search(string videoQuery, string author, string orderby, bool racy, string time, string category)
        {
            YouTubeQuery query = new YouTubeQuery(YouTubeQuery.TopRatedVideo);

            if (String.IsNullOrEmpty(videoQuery) != true)
            {
                query.Query = videoQuery;
            }
            if (String.IsNullOrEmpty(author) != true)
            {
                query.Author = author;
            }
            if (String.IsNullOrEmpty(orderby) != true)
            {
                query.OrderBy = orderby;
            }
            if (racy == true)
            {
                query.SafeSearch = YouTubeQuery.SafeSearchValues.None;
            }
            if (String.IsNullOrEmpty(time) != true)
            {
                if (time == "All Time")
                {
                    query.Time = YouTubeQuery.UploadTime.AllTime;
                }
                else if (time == "Today")
                {
                    query.Time = YouTubeQuery.UploadTime.Today;
                }
                else if (time == "This Week")
                {
                    query.Time = YouTubeQuery.UploadTime.ThisWeek;
                }
                else if (time == "This Month")
                {
                    query.Time = YouTubeQuery.UploadTime.ThisMonth;
                }
            }
            if (String.IsNullOrEmpty(category) != true)
            {
                QueryCategory q = new QueryCategory(new AtomCategory(category));
                query.Categories.Add(q);
            }
            return(ListVideos.GetVideos(query));
        }
Esempio n. 2
0
        private static IEnumerable <Video> GetVideos(string videofeed)
        {
            YouTubeQuery query = new YouTubeQuery(videofeed);

            return(ListVideos.GetVideos(query));
        }