private static IObservable<IReadOnlyList<ISong>> RealSearch(string searchTerm) { var query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri) { OrderBy = "relevance", Query = searchTerm, SafeSearch = YouTubeQuery.SafeSearchValues.None, NumberToRetrieve = RequestLimit }; var settings = new YouTubeRequestSettings("Espera", ApiKey); var request = new YouTubeRequest(settings); return Observable.FromAsync(async () => { Feed<Video> feed = await Task.Run(() => request.Get<Video>(query)); List<Video> entries = await Task.Run(() => feed.Entries.ToList()); return (from video in entries let url = video.WatchPage.OriginalString.Replace("&feature=youtube_gdata_player", String.Empty).Replace("https://", "http://") select new YoutubeSong() { Artist = video.Uploader, Title = video.Title, OriginalPath = url }).ToList(); }) .Catch<IReadOnlyList<YoutubeSong>, Exception>(ex => Observable.Throw<IReadOnlyList<YoutubeSong>>(new Exception("YoutubeSongFinder search failed", ex))); }
public Video GetById(string id) { var query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri + "/" + id); var res = GetVideos(query); var v = res.FirstOrDefault(); return v; }
public IEnumerable<VideoModel> Search(string searchText) { var modelList = new List<VideoModel>(); var settings = new YouTubeRequestSettings("YouTunes", "AIzaSyCgNs6G_0w36g6dhAxxBL4nL7wD3C6jmOw"); var request = new YouTubeRequest(settings); var query = new YouTubeQuery("https://gdata.youtube.com/feeds/api/videos") { Query = searchText }; Feed<Video> feed = null; try { feed = request.Get<Video>(query); foreach (var video in feed.Entries) { modelList.Add(new VideoModel() { VideoTitle = video.Title, VideoId = video.VideoId }); } } catch (GDataRequestException gdre) { } return modelList; }
private void button1_Click(object sender, EventArgs e) { Uri ur = new Uri("http://gdata.youtube.com/feeds/api/videos/fSgGV1llVHM&f=gdata_playlists&c=ytapi-DukaIstvan-MyYouTubeVideosF-d1ogtvf7-0&d=U1YkMvELc_arPNsH4kYosmD9LlbsOl3qUImVMV6ramM"); YouTubeQuery query = new YouTubeQuery("http://gdata.youtube.com/feeds/api/channels?q=vevo"); YouTubeFeed videoFeed = service.Query(query); YouTubeEntry en = (YouTubeEntry)videoFeed.Entries[0]; Video video = request.Retrieve<Video>(new Uri("http://gdata.youtube.com/feeds/api/videos/" + en.VideoId)); Feed<Comment> comments = request.GetComments(video); string cm = ""; foreach (Comment c in comments.Entries) { cm += c.Content + "\n------------------------------------------\n"; } VideoInfo info = new VideoInfo(); info.Get("yUHNUjEs7rQ"); //Video v = request.Retrieve<Video>(videoEntryUrl); //Feed<Comment> comments = request.GetComments(v); //string cm = ""; //foreach (Comment c in comments.Entries) //{ // cm += c.Author + c.Content + "------------------------------------------"; //} }
protected void BBuscador(String track) { string spotUrl = String.Format("http://ws.spotify.com/search/1/track?q={0}", track); WebClient spotService = new WebClient(); spotService.Encoding = Encoding.UTF8; spotService.DownloadStringCompleted += new DownloadStringCompletedEventHandler(SpotService_DownloadTracksCompleted); spotService.DownloadStringAsync(new Uri(spotUrl)); YouTubeRequest request = new YouTubeRequest(settings); YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); query.OrderBy = "relevance"; query.Query = track; query.SafeSearch = YouTubeQuery.SafeSearchValues.None; Feed<Video> videoFeed = request.Get<Video>(query); if (videoFeed.Entries.Count() > 0) { video1 = videoFeed.Entries.ElementAt(0); literal1.Text = String.Format(embed, video1.VideoId); if (videoFeed.Entries.Count() > 1) { video1 = videoFeed.Entries.ElementAt(1); literal1.Text += String.Format(embed, video1.VideoId); } } }
public void Skype_MessageStatus(IChatMessage message, TChatMessageStatus status) { Match output = Regex.Match(message.Body, @"(?:youtube\.\w{2,3}\S+v=|youtu\.be/)([\w-]+)", RegexOptions.IgnoreCase); // Use non-breaking space as a marker for when to not show info. if (output.Success && !message.Body.Contains(" ")) { String youtubeId = output.Groups[1].Value; log.Info("Sending request to YouTube..."); YouTubeQuery ytq = new YouTubeQuery("http://gdata.youtube.com/feeds/api/videos/" + youtubeId); Feed<Video> feed = ytr.Get<Video>(ytq); Video vid = feed.Entries.ElementAt<Video>(0); String title = vid.Title; String user = vid.Author; String rating = vid.RatingAverage.ToString(); int seconds = Int32.Parse(vid.Media.Duration.Seconds) % 60; int minutes = Int32.Parse(vid.Media.Duration.Seconds) / 60; String duration = String.Format(@"{0}:{1:00}", minutes, seconds); message.Chat.SendMessage(String.Format(@"YouTube: ""{0}"" (uploaded by: {1}) (avg rating: {2:F2}) (duration: {3})", title, user, rating, duration)); return; } output = Regex.Match(message.Body, @"^!youtube (.+)", RegexOptions.IgnoreCase); if (output.Success) { String query = output.Groups[1].Value; YouTubeQuery ytq = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); ytq.Query = query; ytq.SafeSearch = YouTubeQuery.SafeSearchValues.None; ytq.NumberToRetrieve = 10; Feed<Video> feed = ytr.Get<Video>(ytq); int count = feed.Entries.Count<Video>(); string url; if (count > 0) { Video vid = feed.Entries.ElementAt<Video>(random.Next(count)); url = vid.WatchPage.ToString(); } else { url = "No matches found."; } message.Chat.SendMessage(String.Format(@"YouTube search for ""{0}"": {1}", query, url)); return; } output = Regex.Match(message.Body, @"^!youtube", RegexOptions.IgnoreCase); if (output.Success) { log.Debug("Got a request for a random video."); String url = randomCache.Count > 0 ? randomCache.Dequeue() : generateRandomVideos(true); message.Chat.SendMessage(String.Format(@"Random YouTube video: {0}", url)); generateRandomVideos(false); return; } }
// Search for a video given a keyword // @return feed of retrieved videos public static Feed<Video> SearchForVideo(string keyword) { YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); query.OrderBy = "relevance"; query.Query = keyword; query.SafeSearch = YouTubeQuery.SafeSearchValues.None; query.NumberToRetrieve = 10; return request.Get<Video>(query); }
public void TimeTest() { YouTubeQuery target = new YouTubeQuery(); // TODO: Initialize to an appropriate value YouTubeQuery.UploadTime expected = new YouTubeQuery.UploadTime(); // TODO: Initialize to an appropriate value YouTubeQuery.UploadTime actual; target.Time = expected; actual = target.Time; Assert.AreEqual(expected, actual); }
public void VQTest() { YouTubeQuery target = new YouTubeQuery(); // TODO: Initialize to an appropriate value string expected = "secret text string"; // TODO: Initialize to an appropriate value string actual; target.VQ = expected; actual = target.VQ; Assert.AreEqual(expected, actual); }
public void PerformSearch (string searchVal) { YouTubeQuery query = new YouTubeQuery (YouTubeQuery.DefaultVideoUri); //order results by the number of views (most viewed first) query.OrderBy = "relevance"; // perform querying with restricted content included in the results // query.SafeSearch could also be set to YouTubeQuery.SafeSearchValues.Moderate query.Query = searchVal; query.SafeSearch = YouTubeQuery.SafeSearchValues.None; this.video_results = yt_request.Get<Video> (query); }
private static IEnumerable<Video> GetVideos(YouTubeQuery q) { YouTubeRequest request = GetRequest(); Feed<Video> feed = null; try { feed = request.Get<Video>(q); } catch (GDataRequestException gdre) { var response = (HttpWebResponse)gdre.Response; } return feed != null ? feed.Entries : null; }
private void AddVideo(YouTubeRequest request, string maxResultsKey, string query, VideoList videoList) { int maxResults = ConfigService.GetConfig(maxResultsKey, 0); if (maxResults > 0) { YouTubeQuery youtubeQuery = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); youtubeQuery.Query = "%22" + query + "%22"; youtubeQuery.SafeSearch = YouTubeQuery.SafeSearchValues.Strict; youtubeQuery.NumberToRetrieve = maxResults; Feed<Video> videos = request.Get<Video>(youtubeQuery); YouTubeVideoParser parser = new YouTubeVideoParser(); parser.Parse(videos, videoList); } }
// once you copied your access and refresh tokens // then you can run this method directly from now on... public void MainX(string args) { GOAuth2RequestFactory requestFactory = RefreshAuthenticate(); YouTubeRequestSettings settings = new YouTubeRequestSettings(_app_name, _clientID, _devKey); YouTubeRequest request = new YouTubeRequest(settings); YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); //order results by the number of views (most viewed first) query.OrderBy = "viewCount"; // search for puppies and include restricted content in the search results // query.SafeSearch could also be set to YouTubeQuery.SafeSearchValues.Moderate query.Query = args; query.SafeSearch = YouTubeQuery.SafeSearchValues.None; //Feed<Video> videoFeed = requestFactory.Get<Video>(query); }
private static IObservable<IReadOnlyList<YoutubeSong>> RealSearch(string searchTerm) { var query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri) { OrderBy = "relevance", Query = searchTerm, SafeSearch = YouTubeQuery.SafeSearchValues.None, NumberToRetrieve = RequestLimit }; // NB: I have no idea where this API blocks exactly var settings = new YouTubeRequestSettings("Espera", ApiKey); var request = new YouTubeRequest(settings); return Observable.FromAsync(async () => { Feed<Video> feed = await Task.Run(() => request.Get<Video>(query)); List<Video> entries = await Task.Run(() => feed.Entries.ToList()); var songs = new List<YoutubeSong>(); foreach (Video video in entries) { var duration = TimeSpan.FromSeconds(Int32.Parse(video.YouTubeEntry.Duration.Seconds)); string url = video.WatchPage.OriginalString .Replace("&feature=youtube_gdata_player", String.Empty) // Unnecessary long url .Replace("https://", "http://"); // Secure connections are not always easy to handle when streaming var song = new YoutubeSong(url, duration) { Artist = video.Uploader, Title = video.Title, Description = video.Description, Rating = video.RatingAverage >= 1 ? video.RatingAverage : (double?)null, ThumbnailSource = new Uri(video.Thumbnails[0].Url), Views = video.ViewCount }; songs.Add(song); } return songs; }) // The API gives no clue what can throw, wrap it all up .Catch<IReadOnlyList<YoutubeSong>, Exception>(ex => Observable.Throw<IReadOnlyList<YoutubeSong>>(new NetworkSongFinderException("YoutubeSongFinder search failed", ex))); }
public IEnumerable<MediaItemViewModel> Search(string query) { YouTubeQuery youtubeQuery = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); //order results by the number of views (most viewed first) youtubeQuery.OrderBy = "viewCount"; // query.SafeSearch could also be set to YouTubeQuery.SafeSearchValues.Moderate youtubeQuery.Query = query; youtubeQuery.SafeSearch = YouTubeQuery.SafeSearchValues.None; youtubeQuery.NumberToRetrieve = 20; return this.Request.Get<Video>(youtubeQuery) .Entries .AsQueryable() .Project() .To<MediaItemViewModel>(); }
public void YouTubeQueryTest() { Tracing.TraceMsg("Entering YouTubeQueryTest"); YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); query.Formats.Add(YouTubeQuery.VideoFormat.RTSP); query.Formats.Add(YouTubeQuery.VideoFormat.Mobile); query.Time = YouTubeQuery.UploadTime.ThisWeek; Assert.AreEqual(query.Uri.AbsoluteUri, YouTubeQuery.DefaultVideoUri + "?format=1%2C6&time=this_week", "Video query should be identical"); query = new YouTubeQuery(); query.Uri = new Uri("https://www.youtube.com/feeds?format=1&time=this_week&racy=included"); Assert.AreEqual(query.Time, YouTubeQuery.UploadTime.ThisWeek, "Should be this week"); Assert.AreEqual(query.Formats[0], YouTubeQuery.VideoFormat.RTSP, "Should be RTSP"); }
public static Feed<Google.YouTube.Video> GetCurtVideos() { try { YouTubeRequestSettings settings = new YouTubeRequestSettings("eLocal", "AI39si6iCFZ_NutrvZe04i9_m7gFhgmPK1e7LF6-yHMAwB-GDO3vC3eD0R-5lberMQLdglNjH3IWUMe3tJXe9qrFe44n2jAUyg"); YouTubeRequest req = new YouTubeRequest(settings); YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); query.Author = "curtmfg"; query.Formats.Add(YouTubeQuery.VideoFormat.Embeddable); query.OrderBy = "viewCount"; // We need to load the feed data for the CURTMfg Youtube Channel Feed<Google.YouTube.Video> video_feed = req.Get<Google.YouTube.Video>(query); return video_feed; } catch (Exception) { return null; } }
private void button1_Click(object sender, EventArgs e) { Uri ur = new Uri( "http://gdata.youtube.com/feeds/api/videos/fSgGV1llVHM&f=gdata_playlists&c=ytapi-DukaIstvan-MyYouTubeVideosF-d1ogtvf7-0&d=U1YkMvELc_arPNsH4kYosmD9LlbsOl3qUImVMV6ramM"); YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); //order results by the number of views (most viewed first) query.OrderBy = "viewCount"; //exclude restricted content from the search query.SafeSearch = YouTubeQuery.SafeSearchValues.None; //string ss = YouTubeQuery.TopRatedVideo; //http://gdata.youtube.com/feeds/api/standardfeeds/top_rated //search for puppies! query.Query = textBox1.Text; query.Categories.Add(new QueryCategory("Music", QueryCategoryOperator.AND)); YouTubeFeed videoFeed = service.Query(query); YouTubeEntry en = (YouTubeEntry) videoFeed.Entries[0]; string s = en.Summary.Text; string s1 = en.Media.Description.Value; Google.GData.YouTube.MediaGroup gr = en.Media; Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + en.VideoId); Video video = request.Retrieve<Video>(videoEntryUrl); Feed<Comment> comments = request.GetComments(video); string cm = ""; foreach (Comment c in comments.Entries) { cm += c.Content + "\n------------------------------------------\n"; } VideoInfo info = new VideoInfo(); info.Get("yUHNUjEs7rQ"); //Video v = request.Retrieve<Video>(videoEntryUrl); //Feed<Comment> comments = request.GetComments(v); //string cm = ""; //foreach (Comment c in comments.Entries) //{ // cm += c.Author + c.Content + "------------------------------------------"; //} }
protected void addVideos(YouTubeFeed videos, YouTubeQuery qu) { downloaQueue.Clear(); foreach (YouTubeEntry entry in videos.Entries) { GUIListItem item = new GUIListItem(); // and add station name & bitrate item.Label = entry.Title.Text; //ae.Entry.Author.Name + " - " + ae.Entry.Title.Content; item.Label2 = ""; item.IsFolder = false; try { item.Duration = Convert.ToInt32(entry.Duration.Seconds, 10); if (entry.Rating != null) item.Rating = (float)entry.Rating.Average; } catch { } string imageFile = Youtube2MP.GetLocalImageFileName(GetBestUrl(entry.Media.Thumbnails)); if (File.Exists(imageFile)) { item.ThumbnailImage = imageFile; item.IconImage = imageFile; item.IconImageBig = imageFile; } else { MediaPortal.Util.Utils.SetDefaultIcons(item); item.OnRetrieveArt += item_OnRetrieveArt; DownloadImage(GetBestUrl(entry.Media.Thumbnails), item); //DownloadImage(GetBestUrl(entry.Media.Thumbnails), item); } item.MusicTag = entry; relatated.Add(item); } //OnDownloadTimedEvent(null, null); }
private static string YoutubeOutput(string input, string flag) { YouTubeRequestSettings settings = new YouTubeRequestSettings("Botler", "AI39si4qO-ubkSyRTofnQsaho8bd2vsIXUd8UI874MI6_ulO6gIyR32tUSQJlok__4H0SoaQ5es7Fl1k6P4fuddYn5zdDjzSvw"); YouTubeRequest request = new YouTubeRequest(settings); YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); if (flag == "+v") query.OrderBy = "viewCount"; else if (flag == "+r") query.OrderBy = "rating"; else if (flag == "+p") query.OrderBy = "published"; else query.OrderBy = "relevance"; query.Query = input; query.SafeSearch = YouTubeQuery.SafeSearchValues.None; Feed<Video> videoFeed = request.Get<Video>(query); string output = printVideoFeed(videoFeed); return output; }
public override List<Result> Search(string pKeyWords) { string youtubeApplicationName = ConfigurationManager.AppSettings["youtube-application-name"]; string youtubeDeveloperKey = ConfigurationManager.AppSettings["youtube-developer-key"]; if (string.IsNullOrWhiteSpace(youtubeApplicationName) || string.IsNullOrWhiteSpace(youtubeDeveloperKey)) throw new Exception("App was unable to find Youtube credentials on the current settings file. Please add youtube-application-name and youtube-developer-key to the appSettings section."); YouTubeRequestSettings requestSettings = new YouTubeRequestSettings(youtubeApplicationName, youtubeDeveloperKey); requestSettings.AutoPaging = false; YouTubeRequest youtubeRequest = new YouTubeRequest(requestSettings); YouTubeQuery youtubeQuery = new YouTubeQuery(YouTubeQuery.DefaultVideoUri) { OrderBy = "viewCount", Query = pKeyWords, NumberToRetrieve = this.MaxResultSearch }; Feed<Video> youtubeVideos = youtubeRequest.Get<Video>(youtubeQuery); List<Result> domainResults = new List<Result>(); foreach (Video video in youtubeVideos.Entries) { domainResults.Add( new Result() { CreatedDate = video.Updated, Type = SourceType.YouTube, Text = string.Format("{0} {1}", video.Description, video.Keywords), Title = video.Title, URL = video.WatchPage.OriginalString } ); } return domainResults; }
private void youTubeSearch(string searchTerm) { YouTubeRequestSettings settings = new YouTubeRequestSettings("SmartHome", developerKeyV2); YouTubeRequest request = new YouTubeRequest(settings); YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); //For Categories //AtomCategory category1 = new AtomCategory("News", YouTubeNameTable.KeywordSchema); //query.Categories.Add(new QueryCategory(category1); //For Playlist // YouTubeQuery query = new YouTubeQuery(YouTubeQuery.BaseUserUri); // Feed<Google.YouTube.Playlist> userPlayList = request.GetPlaylistsFeed("*****@*****.**"); // foreach (Google.YouTube.Playlist p in userPlayList.Entries) // { // Feed<PlayListMember> list = request.GetPlaylist(p); // foreach (Google.YouTube.Video entry in list.Entries) // { // System.Windows.MessageBox.Show(entry.Title); // } // } //order results by the number of views (most viewed first) query.OrderBy = "viewCount"; query.NumberToRetrieve = 50; // search for puppies and include restricted content in the search results // query.SafeSearch could also be set to YouTubeQuery.SafeSearchValues.Moderate query.Query = searchTerm; query.SafeSearch = YouTubeQuery.SafeSearchValues.None; Feed<Google.YouTube.Video> videoFeed = request.Get<Google.YouTube.Video>(query); foreach (Google.YouTube.Video entry in videoFeed.Entries) { //System.Windows.MessageBox.Show(entry.Title); } }
public GenericListItemCollections GetList(SiteItemEntry entry) { GenericListItemCollections res = new GenericListItemCollections(); res.FolderType = 1; string user = entry.GetValue("user"); user = string.IsNullOrEmpty(user) ? "default" : user; YouTubeQuery query = new YouTubeQuery(string.Format("http://gdata.youtube.com/feeds/api/users/{0}/favorites",user)); query.NumberToRetrieve = Youtube2MP.ITEM_IN_LIST; query.StartIndex = entry.StartItem; if (entry.StartItem > 1) res.Paged = true; YouTubeFeed videos = Youtube2MP.service.Query(query); res.Title = videos.Title.Text; foreach (YouTubeEntry youTubeEntry in videos.Entries) { res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry)); } res.Add(Youtube2MP.GetPager(entry, videos)); res.ItemType = ItemType.Video; return res; }
public IEnumerable<Video> Search(string videoQuery, int start = 0, int count = 20) { var author = ""; var orderby = ""; var time = "All Time"; var category = ""; var query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); if (!string.IsNullOrEmpty(videoQuery)) { query.Query = videoQuery; } if (!string.IsNullOrEmpty(author)) { query.Author = author; } if (!string.IsNullOrEmpty(orderby)) { query.OrderBy = orderby; } 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); } var res = GetVideos(query); return res.Skip(start).Take(count); }
private void button1_Click(object sender, EventArgs e) { login = "******"; password = "******"; if (!logged) { YouTubeService service = new YouTubeService("Manager"); service.setUserCredentials(login, password); try { service.QueryClientLoginToken(); } catch (System.Net.WebException ex) { MessageBox.Show(ex.Message); } yousettings = new YouTubeRequestSettings("YTPlayer","AI39si40b25zgBg_U7eheiSnNeb2UMF-3x35HLBYxQDXJEzYOrA8GSQ1vKikFIRSMGOTjBdFvUx4QPz3q72gUkUqOmg9JBx3bQ", login, password); yourequest = new YouTubeRequest(yousettings); logged = true; } YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); query.OrderBy = "viewCount"; query.Query = textBox1.Text; videofeed = yourequest.Get<Video>(query); videofeedcount = videofeed.TotalResults; totalpages = videofeedcount / 25; if (videofeedcount % 25 != 0) totalpages = totalpages + 1; listView1.Items.Clear(); videoIDs.Clear(); foreach (Video entry in videofeed.Entries) { listView1.Items.Add(entry.Title); videoIDs.Add(entry.VideoId); } }
public GenericListItemCollections GetList(SiteItemEntry entry) { GenericListItemCollections res = new GenericListItemCollections(); res.Title = entry.Title; YouTubeQuery query = new YouTubeQuery(string.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads", entry.GetValue("id"))); if (string.IsNullOrEmpty(entry.GetValue("id"))) query = new YouTubeQuery(string.Format("http://gdata.youtube.com/feeds/api/users/default/uploads")); query.NumberToRetrieve = Youtube2MP.ITEM_IN_LIST; query.StartIndex = entry.StartItem; if (entry.StartItem > 1) res.Paged = true; YouTubeFeed videos = Youtube2MP.service.Query(query); res.Title = "Uploads by :" + videos.Authors[0].Name; foreach (YouTubeEntry youTubeEntry in videos.Entries) { res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry)); } res.Add(Youtube2MP.GetPager(entry, videos)); res.ItemType = ItemType.Video; return res; }
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); }
public GenericListItemCollections GetList(SiteItemEntry entry) { GenericListItemCollections res = new GenericListItemCollections(); res.FolderType = 1; string url = string.Format("http://gdata.youtube.com/feeds/api/playlists/{0}", entry.GetValue("id")); if (!string.IsNullOrEmpty(entry.GetValue("url"))) url = entry.GetValue("url"); YouTubeQuery query = new YouTubeQuery(url); query.NumberToRetrieve = 50; do { YouTubeFeed videos = Youtube2MP.service.Query(query); res.Title = videos.Title.Text; foreach (YouTubeEntry youTubeEntry in videos.Entries) { res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry)); } query.StartIndex += 50; if (videos.TotalResults < query.StartIndex + 50) break; } while (true); res.ItemType = ItemType.Video; return res; }
/// <summary> /// returns a message feed based on a youtubeQuery /// </summary> /// <param name="feedQuery"></param> /// <returns>EventFeed</returns> public MessageFeed GetMessages(YouTubeQuery feedQuery) { return base.Query(feedQuery) as MessageFeed; }
/// <summary> /// returns a subscription feed based on a youtubeQuery /// </summary> /// <param name="feedQuery"></param> /// <returns>EventFeed</returns> public SubscriptionFeed GetSubscriptions(YouTubeQuery feedQuery) { return base.Query(feedQuery) as SubscriptionFeed; }
/// <summary> /// returns a message feed based on a youtubeQuery /// </summary> /// <param name="feedQuery"></param> /// <returns>EventFeed</returns> public MessageFeed GetMessages(YouTubeQuery feedQuery) { return(base.Query(feedQuery) as MessageFeed); }
/// <summary> /// returns a subscription feed based on a youtubeQuery /// </summary> /// <param name="feedQuery"></param> /// <returns>EventFeed</returns> public SubscriptionFeed GetSubscriptions(YouTubeQuery feedQuery) { return(base.Query(feedQuery) as SubscriptionFeed); }
/// <summary> /// returns a playlists feed based on a youtubeQuery /// </summary> /// <param name="feedQuery"></param> /// <returns>EventFeed</returns> public PlaylistsFeed GetPlaylists(YouTubeQuery feedQuery) { return(base.Query(feedQuery) as PlaylistsFeed); }
/// <summary> /// returns a playlist feed based on a youtubeQuery /// </summary> /// <param name="feedQuery"></param> /// <returns>EventFeed</returns> public FriendsFeed GetFriends(YouTubeQuery feedQuery) { return(base.Query(feedQuery) as FriendsFeed); }
/// <summary> /// overloaded to create typed version of Query /// </summary> /// <param name="feedQuery"></param> /// <returns>EventFeed</returns> public YouTubeFeed Query(YouTubeQuery feedQuery) { return(base.Query(feedQuery) as YouTubeFeed); }
/// <summary> /// returns a show season feed based on a youtubeQuery /// </summary> /// <param name="feedQuery"></param> /// <returns>EventFeed</returns> public ShowSeasonFeed GetShowSeasons(YouTubeQuery feedQuery) { return(base.Query(feedQuery) as ShowSeasonFeed); }