public void resetAllConnectionAndAccount() { try { Console.WriteLine("Resetting accounts."); System.Threading.Thread.Sleep(60 * 1000 * minDelayMinute / 2); settings = new List <YouTubeRequestSettings>(); requests = new List <YouTubeRequest>(); lastUsed = new List <DateTime>(); foreach (var user in users) { YouTubeRequestSettings s = new YouTubeRequestSettings(user.AppName, user.ApiKey, user.UserName, user.Password); s.Timeout = 10000000; settings.Add(s); YouTubeRequest r = new YouTubeRequest(s); r.Proxy = GetProxyForUser(user); requests.Add(r); lastUsed.Add(DateTime.Now.Subtract(new TimeSpan(0, 0, (int)(2 * (random.NextDouble() + 0.01) * minDelayMinute), 0))); } } catch (Exception) { } }
// // GET: /Candidates/Details/5 public ViewResult Details(int id) { Candidate candidate = context.Candidates.Single(x => x.Id == id); YouTubeRequest req = new YouTubeRequest(new YouTubeRequestSettings("OpenPac", "AI39si5R4licFRGAWgvNI5G6ANPqGfcuyuTWW55nb7rE49bv5kIyMm7YbGpfvUpCX_5nNBJYXztGiUvhULoBQOoEUVQD8xI-Nw")); Uri u = new Uri(string.Format("https://gdata.youtube.com/feeds/api/users/{0}/uploads", candidate.YouTubeId)); Feed<Video> videos = req.Get<Video>(u); List<YouTubeVideo> videoUrls = new List<YouTubeVideo>(); foreach (Video v in videos.Entries) { videoUrls.Add(new YouTubeVideo { VideoId = v.YouTubeEntry.VideoId, Description = v.Description, Title = v.Title, Rating = v.YouTubeEntry.Rating == null ? 0.0 : v.YouTubeEntry.Rating.Average, Updated = v.YouTubeEntry.Updated, Duration = v.YouTubeEntry.Duration.IntegerValue, YouTubeUrl = v.WatchPage.ToString() }); } ViewBag.YouTubeVideos = videoUrls; return View(candidate); }
public void YouTubeUnAuthenticatedRequestTest() { Tracing.TraceMsg("Entering YouTubeUnAuthenticatedRequestTest"); YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytDevKey); settings.AutoPaging = true; settings.Maximum = 50; YouTubeRequest f = new YouTubeRequest(settings); Feed <Video> feed = f.GetStandardFeed(YouTubeQuery.MostPopular); // this will get you the first 25 videos, let's retrieve comments for the first one only foreach (Video v in feed.Entries) { Feed <Comment> list = f.GetComments(v); foreach (Comment c in list.Entries) { Assert.IsTrue(c.AtomEntry != null); Assert.IsTrue(c.Title != null); } break; } }
private void button3_Click(object sender, EventArgs e) { label5.Text = "Search Results:"; try { string searchupd = "http://nicoding.com/api.php?app=ripleech&updtrend=search&term=" + textBox2.Text; HttpWebRequest searchreq = (HttpWebRequest)WebRequest.Create(searchupd); WebResponse searchres = searchreq.GetResponse(); System.IO.StreamReader sr = new System.IO.StreamReader(searchres.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1252")); string pluginsavail = sr.ReadToEnd(); } catch { } listView1.Items.Clear(); YouTubeRequest request = new YouTubeRequest(settings); YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); //order results by the number of views (most viewed first) query.OrderBy = "relevance"; // search for puppies and include restricted content in the search results // query.SafeSearch could also be set to YouTubeQuery.SafeSearchValues.Moderate query.Query = textBox2.Text; query.SafeSearch = YouTubeQuery.SafeSearchValues.None; Feed <Video> videoFeed = request.Get <Video>(query); printVideoFeed(videoFeed); }
// youtube stuff private static bool ytLogin() { //http://trailsinthesand.com/programmatically-uploading-videos-to-youtube/ Console.WriteLine("[yt] Logging in to: " + User.ytUser + " ..."); settings = new YouTubeRequestSettings("Da Stank Bank", Program.ytDevKey, User.ytUser, User.ytPass); request = new YouTubeRequest(settings); string url = "http://gdata.youtube.com/feeds/api/users/" + User.ytUser + "/uploads"; try { Feed <Video> videoFeed = request.Get <Video>(new Uri(url)); foreach (Video entry in videoFeed.Entries) { Console.WriteLine("Entry: " + entry.Id + " -> " + entry.Title); if (entry.ReadOnly == false) { Console.WriteLine("\tVideo is editable by the current user."); } } } catch (ClientFeedException e) { Console.WriteLine("E: " + e); } catch (GDataRequestException) { // if this happens we're likely NOT logged in! return(false); } Console.WriteLine("done."); return(true); }
static void Main(string[] args) { var request = new YouTubeRequest( new YouTubeRequestSettings( "YouTubeTest", "AI39si4diV_7ebufqI-_h1tCkD_8B36b8pqzFlNUQDKEO0hww8nLrqO7UjsOksWQvcUsEILnK9qJIn12cuQbgf4QhZauyw8s8g" )); var feed = request.GetVideoFeed("CGPGrey"); feed.AutoPaging = true; long total = 0; int nVids = 0; Video oldest = null; Video newest = null; foreach (var v in feed.Entries) { if (oldest == null || ComparePublishDate(v, oldest) < 0) { oldest = v; } if (newest == null || ComparePublishDate(v, newest) > 0) { newest = v; } nVids++; int dur = int.Parse(v.Media.Duration.Seconds); total += dur; } var span = PublishDate(newest).Subtract(PublishDate(oldest)); double rate = (double)total * 365.25 / span.TotalDays / 3600; }
public GDataResultAggregator(string playlistURL) { YouTubeRequestSettings settings = new YouTubeRequestSettings(APPNAME, CLIENTID, DEVELKEY); YouTubeRequest request = new YouTubeRequest(settings); _videoFeed = request.Get<Video>(new Uri(playlistURL)); }
/*public void searchForDevices() * { * while (true) * { * BluetoothDeviceInfo[] array = bc.DiscoverDevices(); * foreach (BluetoothDeviceInfo bti in array) * { * fileList.Items.Add(bti.DeviceName); * } * fileList.Clear(); * } * * }*/ public BlueTube() { InitializeComponent(); request = initializeYoutube(); picasaService = initializePicasa(); ol = new ObexListener(ObexTransport.Bluetooth); bc = new InTheHand.Net.Sockets.BluetoothClient(); try { ol.Start(); } catch (Exception e) { Console.WriteLine(e); System.Windows.Forms.MessageBox.Show("Bluetube failed to start, enable a compatible bluetooth adapter"); Environment.Exit(0); } Thread t1 = new Thread(new System.Threading.ThreadStart(DealWithRequest)); t1.Start(); //BluetoothDeviceInfo[] array = bc.DiscoverDevices(); //deviceList.Items.Add(""+array.Length); //for (int i = 0; i < array.Length; i++) //{ // deviceList.Items.Add(array[i].DeviceName); //} }
public static YouTubeRequest GetRequest(string userName, string password) { // let's see if we get a valid authtoken back for the passed in credentials.... YouTubeRequestSettings settings = new YouTubeRequestSettings("YouTubeAspSample", "AI39si4v3E6oIYiI60ndCNDqnPP5lCqO28DSvvDPnQt-Mqia5uPz2e4E-gMSBVwHXwyn_LF1tWox4LyM-0YQd2o4i_3GcXxa2Q", userName, password); YouTubeRequest request = new YouTubeRequest(settings); string authToken = null; try { authToken = request.Service.QueryClientLoginToken(); } catch { } request.Service.SetAuthenticationToken(authToken); //YouTubeRequest request = HttpContext.Current.Session["YTRequest"] as YouTubeRequest; //if (request == null) //{ // YouTubeRequestSettings settings = new YouTubeRequestSettings("YouTubeAspSample", // "AI39si4v3E6oIYiI60ndCNDqnPP5lCqO28DSvvDPnQt-Mqia5uPz2e4E-gMSBVwHXwyn_LF1tWox4LyM-0YQd2o4i_3GcXxa2Q", // HttpContext.Current.Session["token"] as string // ); // settings.AutoPaging = true; // request = new YouTubeRequest(settings); // HttpContext.Current.Session["YTRequest"] = request; //} return(request); }
public static YouTubeVideo.Video CreateYoutubeVideo(string title, string keywords, string description, bool isPrivate, byte[] content, string fileName, string contentType) { //YouTubeRequestSettings settings = new YouTubeRequestSettings("Logicum", "YouTubeDeveloperKey", "YoutubeUserName", "YoutubePassword"); // YouTubeRequestSettings settings = new YouTubeRequestSettings("Zerofootprint", "AI39si5uAJcnGQWqT7bOooT00fTbkCsMjImXlYoyZpkArc49nQvQF-UhxIQDUpwoLxdvf85t97K3wUP2SDrdm1Q8IchJT5mYgQ", "*****@*****.**", "[email protected]"); YouTubeRequestSettings settings = new YouTubeRequestSettings("Zerofootprint", "532982290458-ua1mk31m7ke3pee5vas9rcr6rgfcmavf.apps.googleusercontent.com", "AI39si5uAJcnGQWqT7bOooT00fTbkCsMjImXlYoyZpkArc49nQvQF-UhxIQDUpwoLxdvf85t97K3wUP2SDrdm1Q8IchJT5mYgQ"); YouTubeRequest request = new YouTubeRequest(settings); YouTubeVideo.Video newVideo = new YouTubeVideo.Video(); newVideo.Title = title; newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema)); newVideo.Keywords = keywords; newVideo.Description = description; newVideo.YouTubeEntry.Private = isPrivate; //newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag”, YouTubeNameTable.DeveloperTagSchema)); // alternatively, you could just specify a descriptive string newVideo.YouTubeEntry.setYouTubeExtension(“location”, “Mountain View, CA”); //newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122); Stream stream = new MemoryStream(content); newVideo.YouTubeEntry.MediaSource = new MediaFileSource(stream, fileName, contentType); YouTubeVideo.Video createdVideo = request.Upload(newVideo); return createdVideo; }
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))); }
static private Stream RetrieveData(string sUrl) { if (String.IsNullOrEmpty(sUrl) || sUrl[0] == '/') { return(null); } //sUrl = this.Settings.UpdateUrl(sUrl); HttpWebRequest request = null; HttpWebResponse response = null; try { request = (HttpWebRequest)WebRequest.Create(sUrl); request.Timeout = 20000; response = (HttpWebResponse)request.GetResponse(); if (response != null) // Get the stream associated with the response. { return(response.GetResponseStream()); } } catch (Exception e) { Log.Error(e); } finally { //if (response != null) response.Close(); // screws up the decompression } return(null); }
//---------------------------------------------------------------------------------------------------------- // song landing page dynamic content // public ActionResult GetSongDynamicDetails() { // 1.parse query string //----------------------------------------------------------------------------------------------------- string song_guid = ""; if (Request.QueryString["song_guid"] != null) { song_guid = Request.QueryString["song_guid"]; } //----------------------------------------------------------------------------------------------------- // 2.get video dynamic details //----------------------------------------------------------------------------------------------------- Video video = new Video(); try { YouTubeRequestSettings settings = new YouTubeRequestSettings("hypster", "AI39si5TNjKgF6yiHwUhKbKwIui2JRphXG4hPXUBdlrNh4XMZLXu--lf66gVSPvks9PlWonEk2Qv9fwiadpNbiuh-9TifCNsqA"); YouTubeRequest request = new YouTubeRequest(settings); string feedUrl = "http://gdata.youtube.com/feeds/api/videos/" + song_guid; video = request.Retrieve <Video>(new Uri(feedUrl)); }catch (Exception ex) {} //----------------------------------------------------------------------------------------------------- return(View(video)); }
/// <summary> /// Starts the <see cref="YoutubeSongFinder"/>. /// </summary> public override void Start() { var query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri) { OrderBy = "relevance", Query = searchString, SafeSearch = YouTubeQuery.SafeSearchValues.None }; var settings = new YouTubeRequestSettings("Espera", ApiKey); var request = new YouTubeRequest(settings); Feed <Video> feed = request.Get <Video>(query); foreach (Video video in feed.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://"); /* VLC doesn't like https */ var song = new YoutubeSong(url, AudioType.Mp3, duration, CoreSettings.Default.StreamYoutube) { Title = video.Title, Description = video.Description, Rating = video.RatingAverage, ThumbnailSource = new Uri(video.Thumbnails[0].Url) }; this.InternSongsFound.Add(song); this.OnSongFound(new SongEventArgs(song)); } this.OnFinished(EventArgs.Empty); }
// // GET: /Candidates/Details/5 public ViewResult Details(int id) { Candidate candidate = context.Candidates.Single(x => x.Id == id); YouTubeRequest req = new YouTubeRequest(new YouTubeRequestSettings("OpenPac", "AI39si5R4licFRGAWgvNI5G6ANPqGfcuyuTWW55nb7rE49bv5kIyMm7YbGpfvUpCX_5nNBJYXztGiUvhULoBQOoEUVQD8xI-Nw")); Uri u = new Uri(string.Format("https://gdata.youtube.com/feeds/api/users/{0}/uploads", candidate.YouTubeId)); Feed <Video> videos = req.Get <Video>(u); List <YouTubeVideo> videoUrls = new List <YouTubeVideo>(); foreach (Video v in videos.Entries) { videoUrls.Add(new YouTubeVideo { VideoId = v.YouTubeEntry.VideoId, Description = v.Description, Title = v.Title, Rating = v.YouTubeEntry.Rating == null ? 0.0 : v.YouTubeEntry.Rating.Average, Updated = v.YouTubeEntry.Updated, Duration = v.YouTubeEntry.Duration.IntegerValue, YouTubeUrl = v.WatchPage.ToString() }); } ViewBag.YouTubeVideos = videoUrls; return(View(candidate)); }
private void AddVideoFeed(YouTubeQuery q) { try { YouTubeRequest request = GetRequest(); Feed <Video> feed = request.Get <Video>(q); feed.Maximum = 500;//11_5_13 ss: limited to 500 now?? if (!Object.Equals(feed, null) && !Object.Equals(feed.Entries, null)) { foreach (Video vid in feed.Entries) { _channel.Feed.Add(new ChannelVideo(vid)); } } } catch (GDataRequestException gdre) { using (var logClient = new BILoggerServiceClient()) logClient.HandleException(gdre.Message, "Query: " + q.Query, Utility.ApplicationName, LogTypeEnum.Error, LogActionEnum.LogAndEmail, "ChannelManager.GetVideos()", "Drone.API.YouTube Exception", string.Empty, string.Empty, System.Environment.MachineName); } catch (Exception e) { using (var logClient = new BILoggerServiceClient()) logClient.HandleBIException(e.ConvertToBIException(LogActionEnum.Log, LogTypeEnum.Error, "Drone.API.YouTube Exception", "ChannelManager.GetVideos()", "nouser", System.Environment.MachineName, "Query: " + q.Query)); } }
//---------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------- // perform youtube search public ActionResult MusicYTID() { string search_string = ""; if (Request.QueryString["ss"] != null) { //--------------------------------------------------------------------- search_string = Request.QueryString["ss"].ToString(); ViewBag.search_string = search_string.Replace(" ", "+"); //--------------------------------------------------------------------- } // 2.get video dynamic details //----------------------------------------------------------------------------------------------------- Video video = null; try { YouTubeRequestSettings settings = new YouTubeRequestSettings("hypster", "AI39si5TNjKgF6yiHwUhKbKwIui2JRphXG4hPXUBdlrNh4XMZLXu--lf66gVSPvks9PlWonEk2Qv9fwiadpNbiuh-9TifCNsqA"); YouTubeRequest request = new YouTubeRequest(settings); string feedUrl = "http://gdata.youtube.com/feeds/api/videos/" + HttpUtility.UrlEncode(search_string.Replace("+", " ")); video = request.Retrieve <Video>(new Uri(feedUrl)); } catch (Exception ex) { } //----------------------------------------------------------------------------------------------------- return(View(video)); }
public YoutubeVideo GetVideoById(string videoId) { YouTubeService service = new YouTubeService(_applicationName, _developerKey); string url = String.Format("{0}/{1}?v=2&", _videoUrl, videoId); YouTubeQuery searchQuery = new YouTubeQuery(url); var result = service.Query(searchQuery); YouTubeEntry entry = result.Entries.FirstOrDefault() as YouTubeEntry; var video = entry.ToYoutubeVideo(); string commentUrl = String.Format("http://gdata.youtube.com/feeds/api/videos/{0}/comments?max-results={1}&start-index={2}", videoId, 50, 1); var youTubeRequestSettings = new YouTubeRequestSettings(_applicationName, _developerKey); var request = new YouTubeRequest(youTubeRequestSettings); Feed <Comment> comments = request.Get <Comment>(new Uri(commentUrl)); foreach (var item in comments.Entries) { video.Comments.Add(new YoutubeComment { Author = item.Author, UpdatedOn = item.Updated, Title = item.Title, Content = item.Content, }); } return(video); }
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 PlaylistMaker(string queryList, string playlistName, string playlistSummary, RequestSettings settings) { _queryList = queryList.Split('\n'); _playlistName = playlistName; _playlistSummary = playlistSummary; _request = settings.MakeRequest(); }
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; }
public static YouTubeRequest GetRequest1() { YouTubeRequestSettings settings = new YouTubeRequestSettings("LifeTube", ConfigurationManager.AppSettings["YouTubeAPIKey"], ConfigurationManager.AppSettings["YouTubeUsername"], ConfigurationManager.AppSettings["YouTubePassword"]); YouTubeRequest request = new YouTubeRequest(settings); Google.YouTube.Video newVideo = new Google.YouTube.Video(); newVideo.Title = "My first Movie"; newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema)); newVideo.Keywords = "cars, funny"; newVideo.Description = "My description"; newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag", YouTubeNameTable.DeveloperTagSchema)); newVideo.YouTubeEntry.Private = false; newVideo.YouTubeEntry.setYouTubeExtension("location", "Somerville, MA"); var token = request.CreateFormUploadToken(newVideo); var strToken = token.Token; var strFormAction = token.Url + "?nexturl=http://[ LifeTube ]/form/post-video-step2.aspx?Complete=1"; //Session["YTRequest"] = request; return request; //return View(request); }
public static string getSearchVal(string searchvar) { searchtext = searchvar; YouTubeRequestSettings yy = new YouTubeRequestSettings("unitysg", "AIzaSyAS1TLHGyfD6yP596kpmckOhUepSPmo8hM"); YouTubeRequest request = new YouTubeRequest(yy); YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri + "?region=SG&v=2"); //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 = searchvar; query.SafeSearch = YouTubeQuery.SafeSearchValues.None; Feed <Video> videoFeed = request.Get <Video>(query); if (printVideoFeed(videoFeed) == true) { return("Success"); } else { return("Fail"); } }
//string wth; FIXED -- Issue with object scope? Will fix later. This is a workaround. public MainForm() { InitializeComponent(); buttonUpload.Enabled = false; //Disable buttons by default. textComplete.Visible = false; btnDelete.Enabled = false; btnAdd.Enabled = false; comboCategory.SelectedIndex = 7; //No selection is invalid. vidFlag = false; //User must provide credentials and a video before uploading. loginFlag = false; //Saved settings folderBrowserDialog.SelectedPath = stored_IncludeFolder; includeTextBox.Text = stored_IncludeFolder; VideoWatcher.Path = stored_IncludeFolder; VideoFilename = Youtube_Uploader.Properties.Settings.Default.FilesLib; VideoId = Youtube_Uploader.Properties.Settings.Default.IdLib; VideoStatus = Youtube_Uploader.Properties.Settings.Default.StatusLib; YouTubeRequestSettings settings = new YouTubeRequestSettings("Deprecated", key, Youtube_Uploader.Properties.Settings.Default.UsernameYT, Youtube_Uploader.Properties.Settings.Default.PasswordYT); request = new YouTubeRequest(settings); drawVideoList(); }
public void YouTubePlaylistBatchTest() { Tracing.TraceMsg("Entering YouTubePlaylistBatchTest"); YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytDevKey, this.ytUser, this.ytPwd); YouTubeRequest f = new YouTubeRequest(settings); // GetVideoFeed get's you a users video feed Feed <Playlist> feed = f.GetPlaylistsFeed(null); // this will get you just the first 25 playlists. List <Playlist> list = new List <Playlist>(); int i = 0; foreach (Playlist p in feed.Entries) { list.Add(p); // add everything you want to do here... } Feed <PlayListMember> videos = f.GetPlaylist(list[0]); List <PlayListMember> lvideo = new List <PlayListMember>(); foreach (PlayListMember v in videos.Entries) { lvideo.Add(v); // add everything you want to do here... } List <PlayListMember> batch = new List <PlayListMember>(); PlayListMember toBatch = new PlayListMember(); toBatch.Id = lvideo[1].Id; toBatch.VideoId = lvideo[1].VideoId; toBatch.BatchData = new GDataBatchEntryData(); toBatch.BatchData.Id = "NEWGUY"; toBatch.BatchData.Type = GDataBatchOperationType.insert; batch.Add(toBatch); toBatch = lvideo[1]; toBatch.BatchData = new GDataBatchEntryData(); toBatch.BatchData.Id = "DELETEGUY"; toBatch.BatchData.Type = GDataBatchOperationType.delete; batch.Add(toBatch); toBatch = lvideo[0]; toBatch.Position = 1; toBatch.BatchData = new GDataBatchEntryData(); toBatch.BatchData.Id = "UPDATEGUY"; toBatch.BatchData.Type = GDataBatchOperationType.update; batch.Add(toBatch); Feed <PlayListMember> updatedVideos = f.Batch(batch, videos); foreach (Video v in updatedVideos.Entries) { Assert.IsTrue(v.BatchData.Status.Code < 300, "one batch operation failed: " + v.BatchData.Status.Reason); } }
public void YouTubePlaylistRequestTest() { Tracing.TraceMsg("Entering YouTubePlaylistRequestTest"); YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytDevKey, this.ytUser, this.ytPwd); YouTubeRequest f = new YouTubeRequest(settings); // GetVideoFeed gets you a users video feed Feed <Playlist> feed = f.GetPlaylistsFeed(null); // this will get you just the first 25 videos. foreach (Playlist p in feed.Entries) { Assert.IsTrue(p.AtomEntry != null); Assert.IsTrue(p.Title != null); Feed <PlayListMember> list = f.GetPlaylist(p); foreach (PlayListMember v in list.Entries) { Assert.IsTrue(v.AtomEntry != null, "There should be an atomentry"); Assert.IsTrue(v.Title != null, "There should be a title"); Assert.IsTrue(v.VideoId != null, "There should be a videoID"); // there might be no watchpage (not published yet) // Assert.IsTrue(v.WatchPage != null, "There should be a watchpage"); } } }
private Video GetSongVideoByTitle(string song_title) { YouTubeRequestSettings settings = new YouTubeRequestSettings("hypster", "AI39si5TNjKgF6yiHwUhKbKwIui2JRphXG4hPXUBdlrNh4XMZLXu--lf66gVSPvks9PlWonEk2Qv9fwiadpNbiuh-9TifCNsqA"); YouTubeRequest request = new YouTubeRequest(settings); string feedUrl = String.Format("http://gdata.youtube.com/feeds/api/videos?q={0}&category=Music&format=5&start-index={1}&orderby=viewCount", HttpUtility.UrlEncode(song_title.Replace("+", " ")), 1); Feed <Video> videoFeed = null; Video ret_Video = new Video(); try { videoFeed = request.Get <Video>(new Uri(feedUrl)); if (videoFeed != null) { foreach (var item in videoFeed.Entries) { ret_Video = item; break; } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } return(ret_Video); }
public Youtube() { YouTubeRequestSettings settings = new YouTubeRequestSettings("DemoFacebookFeature", "AI39si4cTAJSx5HF1qHrhfD_ws7kUEnk0Tr02WcFPiMf96nTxczLMT8a_lJqGhlbKRsY0YZE5BYhO-gu2y7rXsQesC3Jf2-jGA"); Request = new YouTubeRequest(settings); VideoFeeds = new List<Video>(); NewVideos = new List<Video>(); }
/// <summary> /// Checks the login. /// </summary> private void CheckLogin() { try { var request = new YouTubeRequest(this.settings); request.Service.QueryClientLoginToken(); this.UserLoggedIn(null, request); ((DependencyObject)this.View).Dispatcher.BeginInvoke(new Action(() => { this.StartupPageCompleted(null, new Tuple <bool, YouTubeRequest>(true, request)); if (this.IsRememberMeChecked) { Application.Current.Properties[0] = this.IsRememberMeChecked; Application.Current.Properties[1] = this.Username; Application.Current.Properties[2] = ((StartupPageView)this.View).auth.Password; } else { Application.Current.Properties.Clear(); } this.IsLoading = false; })); } catch (Exception ex) { this.IsLoading = false; MessageBox.Show(ex.Message); } }
public void login(string user, string pass) { devkey = Properties.Resources.devkey.Length == 0 ? File.ReadAllText("devkey") : System.Text.Encoding.Default.GetString(Properties.Resources.devkey); YouTubeRequestSettings settings = new YouTubeRequestSettings("SubBuddy", devkey, user, pass); request = new YouTubeRequest(settings); }
public void YouTubeRequestInsertTest() { Tracing.TraceMsg("Entering YouTubeRequestInsertTest"); YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytDevKey, this.ytUser, this.ytPwd); YouTubeRequest f = new YouTubeRequest(settings); Video v = new Video(); v.Title = "Sample upload"; v.Description = "This is a test with and & in it"; MediaCategory category = new MediaCategory("Nonprofit"); category.Attributes["scheme"] = YouTubeService.DefaultCategory; v.Tags.Add(category); v.Keywords = "math"; v.YouTubeEntry.MediaSource = new MediaFileSource(Path.Combine(this.resourcePath, "test_movie.mov"), "video/quicktime"); Video newVideo = f.Upload(this.ytUser, v); newVideo.Title = "This test upload will soon be deleted"; Video updatedVideo = f.Update(newVideo); Assert.AreEqual(updatedVideo.Description, newVideo.Description, "Description should be equal"); Assert.AreEqual(updatedVideo.Keywords, newVideo.Keywords, "Keywords should be equal"); newVideo.YouTubeEntry.MediaSource = new MediaFileSource(Path.Combine(this.resourcePath, "test.mp4"), "video/mp4"); Video last = f.Update(updatedVideo); f.Delete(last); }
public void YouTubePageSizeTest() { Tracing.TraceMsg("Entering YouTubePageSizeTest"); YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytDevKey, this.ytUser, this.ytPwd); settings.PageSize = 15; YouTubeRequest f = new YouTubeRequest(settings); Feed <Video> feed = f.GetStandardFeed(YouTubeQuery.MostPopular); int iCount = 0; // this will get you just the first 15 videos. foreach (Video v in feed.Entries) { iCount++; f.Settings.PageSize = 5; Feed <Comment> list = f.GetComments(v); int i = 0; foreach (Comment c in list.Entries) { i++; } Assert.IsTrue(i <= 5, "the count should be smaller/equal 5"); Assert.IsTrue(list.PageSize == -1 || list.PageSize == 5, "the returned pagesize should be 5 or -1 as well"); } Assert.AreEqual(iCount, 15, "the outer feed should count 15"); Assert.AreEqual(feed.PageSize, 15, "outer feed pagesize should be 15"); }
public void YouTubeSubscriptionsTest() { Tracing.TraceMsg("Entering YouTubeSubscriptionsTest"); string playlistID = "4A3A73D5172EB90A"; YouTubeRequestSettings settings = new YouTubeRequestSettings(this.ApplicationName, this.ytDevKey, this.ytUser, this.ytPwd); // settings.PageSize = 15; YouTubeRequest f = new YouTubeRequest(settings); // this returns the server default answer Feed <Subscription> feed = f.GetSubscriptionsFeed(null); foreach (Subscription s in feed.Entries) { Assert.IsTrue(s.PlaylistId != null, "There should be a PlaylistId"); Assert.IsTrue(s.PlaylistTitle != null, "There should be a PlaylistTitle"); if (s.PlaylistId == playlistID) { f.Delete(s); } } Subscription sub = new Subscription(); sub.Type = SubscriptionEntry.SubscriptionType.playlist; sub.PlaylistId = playlistID; f.Insert(feed, sub); // this returns the server default answer feed = f.GetSubscriptionsFeed(null); List <Subscription> list = new List <Subscription>(); foreach (Subscription s in feed.Entries) { Assert.IsTrue(s.PlaylistId != null, "There should be a PlaylistId"); Assert.IsTrue(s.PlaylistTitle != null, "There should be a PlaylistTitle"); if (s.PlaylistId == playlistID) { list.Add(s); } } Assert.IsTrue(list.Count > 0, "There should be one subscription matching"); foreach (Subscription s in list) { f.Delete(s); } foreach (Subscription s in feed.Entries) { Assert.IsTrue(s.PlaylistId != null, "There should be a PlaylistId"); Assert.IsTrue(s.PlaylistTitle != null, "There should be a PlaylistTitle"); Assert.IsFalse(s.PlaylistId == playlistID, "They should be gone"); } }
private void ButtonSaveSettings_Click(object sender, EventArgs e) { bool fHide = true; if (this.isAuthenticated.Checked == false && this.userName.Text.Length > 0) { // let's see if we get a valid authtoken back for the passed in credentials.... YouTubeRequestSettings settings = new YouTubeRequestSettings(AppKey, YTDEVKEY, this.userName.Text, this.passWord.Text); // settings.PageSize = 15; this.ytRequest = new YouTubeRequest(settings); try { this.authToken = this.ytRequest.Service.QueryClientLoginToken(); this.passWord.Text = ""; } catch { MessageBox.Show("There was a problem with your credentials"); this.authToken = null; fHide = false; } OnAuthenticationModified(this.authToken); } // let's save the username to the registry, but not the password RegistryKey ytNotifier = Registry.CurrentUser.OpenSubKey(YTNOTIFIERKEY, true); if (ytNotifier == null) { ytNotifier = Registry.CurrentUser.CreateSubKey(YTNOTIFIERKEY); } ytNotifier.SetValue("initialDataPullTime", this.InitialDataPullTime.Value, RegistryValueKind.DWord); ytNotifier.SetValue("updateFrequency", this.UpdateFrequency.Value, RegistryValueKind.DWord); ytNotifier.SetValue("notificationDuration", this.notifcationBalloons.Value, RegistryValueKind.DWord); ytNotifier.SetValue("userList", GetUserNamesToSave()); this.initialPullinHours = (int)this.InitialDataPullTime.Value; this.updateFrequency = (int)this.UpdateFrequency.Value; this.notificationDuration = (int)this.notifcationBalloons.Value; if (this.authToken != null) { ytNotifier.SetValue("userName", this.userName.Text); ytNotifier.SetValue("token", this.authToken); this.user = this.userName.Text; } if (fHide == true) { HideMe(); UpdateActivities(); } }
public static YouTubeRequest GetRequest() { YouTubeRequestSettings settings = new YouTubeRequestSettings("Chalkable Youtube app", "AI39si6y_3ZKWG2A4_-v5ogSal_5Y41jmsiQ3aYD0AUVHBTT7mNjOAhh1r24xJWUkki67hLg0l4EXZHS-d4h-kysPd9yGAV0Wg"); settings.AutoPaging = true; YouTubeRequest request = new YouTubeRequest(settings); return request; }
public VideoEntry GetById(string videoId) { var request = new YouTubeRequest(_settings); var video = request.Retrieve<Video>(new Uri(String.Format("http://gdata.youtube.com/feeds/api/videos/{0}", videoId))); return _videoEntryFactory.Build(video); }
public YouTubePlugin() { random = new Random(); ytr = new YouTubeRequest( new YouTubeRequestSettings("Dynamic Skype Bot", "ytapi-SebastianPaaske-DynamicSkypeBot-b3hp906d-0", "AI39si59QPSboGTxgVnE0OD5nO49p1ok9KAoM0BuT9KkyL-VNzkrUA2F1O46FqArUrppYc5AGwrE-xQhaefb_cp4mgHuw36F9Q") ); randomCache = new Queue<string>(); }
private YouTubeRequest GetRequest() { YouTubeRequestSettings settings = new YouTubeRequestSettings(_appName, _devKey); settings.AutoPaging = true; YouTubeRequest request = new YouTubeRequest(settings); return(request); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>runs a test on the YouTube factory object</summary> ////////////////////////////////////////////////////////////////////// [Test] public void YouTubeRequestActivitiesTest() { Tracing.TraceMsg("Entering YouTubeRequestActivitiesTest"); YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytDevKey, this.ytUser, this.ytPwd); // settings.PageSize = 15; YouTubeRequest f = new YouTubeRequest(settings); // this returns the server default answer Feed <Activity> feed = f.GetActivities(); foreach (Activity a in feed.Entries) { Assert.IsTrue(a.VideoId != null, "There should be a VideoId"); } // now let's find all that happened in the last 24 hours DateTime t = DateTime.Now.AddDays(-1); // this returns the all activities for the last 24 hours default answer try { Feed <Activity> yesterday = f.GetActivities(t); foreach (Activity a in yesterday.Entries) { Assert.IsTrue(a.VideoId != null, "There should be a VideoId"); } } catch (GDataNotModifiedException e) { Assert.IsTrue(e != null); } t = DateTime.Now.AddMinutes(-1); // this returns the all activities for the last 1 minute, should be empty or throw a not modified try { Feed <Activity> lastmin = f.GetActivities(t); int iCount = 0; foreach (Activity a in lastmin.Entries) { iCount++; } Assert.IsTrue(iCount == 0, "There should be no activity for the last minute"); } catch (GDataNotModifiedException e) { Assert.IsTrue(e != null); } }
public static YouTubeRequest GetRequest() { YouTubeRequestSettings settings = new YouTubeRequestSettings("Chalkable Youtube app", "AI39si6y_3ZKWG2A4_-v5ogSal_5Y41jmsiQ3aYD0AUVHBTT7mNjOAhh1r24xJWUkki67hLg0l4EXZHS-d4h-kysPd9yGAV0Wg"); settings.AutoPaging = true; YouTubeRequest request = new YouTubeRequest(settings); return(request); }
private static YouTubeRequest GetRequest() { var youtubeApiKey = ConfigurationManager.AppSettings["youtubeApiKey"]; var applicationName = ConfigurationManager.AppSettings["applicationName"]; var youtubeUserName = ConfigurationManager.AppSettings["youtubeUserName"]; var youtubePassword = ConfigurationManager.AppSettings["youtubePassword"]; var settings = new YouTubeRequestSettings(applicationName, youtubeApiKey, youtubeUserName, youtubePassword); var request = new YouTubeRequest(settings); return request; }
public async Task TestMethod1() { YouTubeRequest request = new YouTubeRequest(); request.channelId = "UCIzSrkEk2QHHoyWIH1B1Tnw"; IYouTubeChannelVideosService service = _serviceProvider.GetService <IYouTubeChannelVideosService>(); var result = await service.ChannelVideos(request); Assert.IsNotNull(result); }
public BaseServices(IStreamusData data, bool hasYoutubeAccess = false) { this.Data = data; if (hasYoutubeAccess) { this.Settings = new YouTubeRequestSettings("MusicStreamer", "AI39si65eMHvaqUdhOESn1Z4xR9pSXPECS4BaQZ0GHA5sokyJY-QJGniwhQlccPwOMx8XBwgutGTC6keZToeFeURvcHFvVMGiw"); this.Request = new YouTubeRequest(this.Settings); } }
public bool InitYouTubeRequest () { YouTubeRequestSettings yt_request_settings = new YouTubeRequestSettings (app_name, client_id, developer_key); this.yt_request = new YouTubeRequest (yt_request_settings); if (this.yt_request != null && yt_request_settings != null) { return true; } return false; }
private void AddVideo(YouTubeRequest request, string urlTemplate, string maxResultsKey, VideoList videoList) { int maxResults = ConfigService.GetConfig(maxResultsKey, 0); if (maxResults > 0) { string url = string.Format(urlTemplate, maxResults); Feed<Video> videos = request.Get<Video>(new Uri(url)); YouTubeVideoParser parser = new YouTubeVideoParser(); parser.Parse(videos, videoList); } }
private void Guncelle() { using (OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=hesap.mdb")) { conn.Open(); OleDbCommand komut = new OleDbCommand(); komut.Connection = conn; komut.CommandText = "Select * from hesap"; // sorgu / komut cumlemi yazıyorum. komut.ExecuteNonQuery(); // insert , updateiçin gerekli satir sayisi donduruyoruz. OleDbDataReader dr = komut.ExecuteReader(); // datareader olusturup komut sorgulayıp veritabaninda okuma işlemini tanıtıyoruz while (dr.Read()) // datareader ile okuyoruz. { string hadi = dr["hadi"].ToString(); string kadi = dr["kadi"].ToString(); string q; using (WebClient asd = new WebClient()) { asd.Encoding = Encoding.UTF8; q = asd.DownloadString("http://gdata.youtube.com/feeds/api/users/" + kadi + "/uploads?v=2&alt=jsonc&max-results=0"); } string[] adet1 = q.Split(new string[] { "totalItems\":" }, StringSplitOptions.None); string[] adet2 = adet1[1].Split(','); listView1.Items.Add(new ListViewItem(new string[] { hadi, "Adet: "+adet2[0] })); } dr.Close(); komut.ExecuteNonQuery(); // insert , updateiçin gerekli satir sayisi donduruyoruz. dr = komut.ExecuteReader(); // datareader olusturup komut sorgulayıp veritabaninda okuma işlemini tanıtıyoruz while (dr.Read()) // datareader ile okuyoruz. { string kadi = dr["hadi"].ToString(); // veritabanimdaki "kadi" alanımdaki veriyi alip kadi değişkenine atıyorum(yukarıda string olusturmustum) string sifre = dr["hsifresi"].ToString(); // aynı durum söz konusu string devkey = dr["devkey"].ToString(); Random a = new Random(); string id = a.Next(100000, 999999).ToString(); YouTubeRequestSettings settings = new YouTubeRequestSettings(id, devkey, kadi,sifre); YouTubeRequest request = new YouTubeRequest(settings); string feedUrl = "https://gdata.youtube.com/feeds/api/users/default/uploads"; Feed<Video> videoFeed = request.Get<Video>(new Uri(feedUrl)); foreach (Video entry in videoFeed.Entries) { string vid_thumb ="http://img.youtube.com/vi/"+entry.VideoId+"/0.jpg"; int izlenme = entry.ViewCount; if(izlenme == -1) izlenme = 0; listView1.Items.Add(new ListViewItem(new string[] { kadi,entry.YouTubeEntry.Title.Text,izlenme.ToString() })); } } } }
public VideoTitleParseResult GetTitle(string id) { var settings = new YouTubeRequestSettings("VocaDB", null); var request = new YouTubeRequest(settings); var videoEntryUrl = new Uri(string.Format("http://gdata.youtube.com/feeds/api/videos/{0}", id)); try { var video = request.Retrieve<Video>(videoEntryUrl); var thumbUrl = video.Thumbnails.Count > 0 ? video.Thumbnails[0].Url : string.Empty; return VideoTitleParseResult.CreateSuccess(video.Title, video.Author, thumbUrl); } catch (Exception x) { return VideoTitleParseResult.CreateError(x.Message); } }
public override VideoResponse GetVideo(VideoRequest videoRequest) { Uri videoUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + videoRequest.VideoId); try { var request = new YouTubeRequest(new YouTubeRequestSettings(Application, ApiKey)); var video = request.Retrieve<Video>(videoUrl); return new VideoResponse() { Video = video }; } catch (Exception e) { return new VideoResponse() { Video = 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); } }
public static YouTubeRequest GetRequest() { YouTubeRequest request = HttpContext.Current.Session["YTRequest"] as YouTubeRequest; if (request == null) { YouTubeRequestSettings settings = new YouTubeRequestSettings("YouTubeAspSample", "AI39si4v3E6oIYiI60ndCNDqnPP5lCqO28DSvvDPnQt-Mqia5uPz2e4E-gMSBVwHXwyn_LF1tWox4LyM-0YQd2o4i_3GcXxa2Q", HttpContext.Current.Session["token"] as string ); settings.AutoPaging = true; request = new YouTubeRequest(settings); HttpContext.Current.Session["YTRequest"] = request; } return request; }
// 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); }
internal List<KeyValuePair<string, List<Video>>> GetListOfSubscriptions(Settings i_settings) { List<KeyValuePair<string, List<Video>>> resObj = new List<KeyValuePair<string, List<Video>>> (); YouTubeRequestSettings settings = new YouTubeRequestSettings( i_settings.appName , i_settings.devKey , i_settings.username , i_settings.password); YouTubeRequest request = new YouTubeRequest(settings); Feed<Subscription> feedOfSubcr = request.GetSubscriptionsFeed(i_settings.userShort); string[] stringSeparators = new string[] { "Activity of:" }; foreach (Subscription subItem in feedOfSubcr.Entries) { string keyStr = subItem.ToString().Split(stringSeparators, StringSplitOptions.None)[1].Trim(); List<Video> listOfVideos = new List<Video>(); string userName = subItem.UserName; string url = string.Format(i_settings.urlFormatter, userName); Feed<Video> videoFeed = request.Get<Video>(new Uri(url)); int depth = 0; foreach (Video entry in videoFeed.Entries) { //strBuilder.AppendLine(" " + entry.Title); listOfVideos.Add(entry); depth++; if (depth >= i_settings.feedDepth) { break; } } if (listOfVideos.Count > 0) { KeyValuePair<string, List<Video>> subscriptionO = new KeyValuePair<string, List<Video>>(keyStr, listOfVideos); resObj.Add(subscriptionO); } } return resObj; }
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 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; } }
static void Main(string[] args) { YouTubeRequest request = new YouTubeRequest(new YouTubeRequestSettings(AppName, DevKey)); var playlists = request.GetPlaylistsFeed("QualityCartoons"); foreach (var playlistItem in playlists.Entries) { LoadPlaylist(request, playlistItem); //var query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); //query.Author = "QualityCartoons"; //query.SafeSearch = YouTubeQuery.SafeSearchValues.None; //Feed<Video> videoFeed = request.Get<Video>(query); } Console.ReadKey(true); }
private static void LoadPlaylist(YouTubeRequest request, Playlist playlistItem) { Debug.WriteLine(String.Format("[{2}] Title: {1}\tId: {0}", playlistItem.Id, playlistItem.Title, playlistItem.CountHint)); Playlist playlist = request.Retrieve<Playlist>(new Uri(playlistItem.Self)); if (playlistItem.CountHint == playlist.PlaylistsEntry.Feed.Entries.Count()) Debug.WriteLine("All Entries retrieved"); else Debug.WriteLine(String.Format("{0} entry(ies) retrieved", playlist.PlaylistsEntry.Feed.Entries.Count())); foreach (var playlistEntryItem in playlist.PlaylistsEntry.Feed.Entries) { Video video = request.Retrieve<Video>(new Uri(playlistEntryItem.SelfUri.ToString())); Debug.WriteLine(String.Format("{0}\t| {1}", video.VideoId, video.Title)); //PrintVideoEntry(video); } }
public VideoList Search(string query) { VideoList videoList = new VideoList(); try { string api = ConfigService.GetConfig(ConfigKeys.YOUTUBE_API_KEY, ""); YouTubeRequestSettings settings = new YouTubeRequestSettings("TheInternetBuzz.org", "TheInternetBuzz.org", api); YouTubeRequest request = new YouTubeRequest(settings); AddVideo(request, ConfigKeys.YOUTUBE_SEARCH_MAXRESULTS, query, videoList); } catch (Exception exception) { ErrorService.Log("YouTubeSearchService", "Search", query, exception); } return videoList; }
public void upload() { Random a = new Random(); string id = a.Next(100000, 999999).ToString(); YouTubeRequestSettings settings = new YouTubeRequestSettings(id, developerKey, hesapAdi, hesapSifresi); YouTubeRequest request = new YouTubeRequest(settings); Video newVideo = new Video(); ((GDataRequestFactory)request.Service.RequestFactory).Timeout = 9999999; newVideo.Title = videoAdi; newVideo.Tags.Add(new MediaCategory(videoTur, YouTubeNameTable.CategorySchema)); newVideo.Keywords = etiketler; newVideo.Description = aciklama; newVideo.YouTubeEntry.Private = false; newVideo.YouTubeEntry.MediaSource = new MediaFileSource(videoYolu, "video/x-flv"); request.Upload(newVideo); }
static void Main(string[] args) { Uri youTubeLink = new Uri("http://www.youtube.com/watch?v=ItqQ2EZziB8"); var parameters = System.Web.HttpUtility.ParseQueryString(youTubeLink.Query); var videoId = parameters["v"]; Uri youTubeApi = new Uri(string.Format("http://gdata.youtube.com/feeds/api/videos/{0}", videoId)); YouTubeRequestSettings settings = new YouTubeRequestSettings(null, null); YouTubeRequest request = new YouTubeRequest(settings); var result = request.Retrieve<Video>(youTubeApi); Console.WriteLine(result.Title); Console.WriteLine(result.Description); Console.WriteLine(result.ViewCount); Console.ReadLine(); }
public FormUploadToken addMetadata(String title, String description, String keyword) { String developerKey = "AI39si5IOTNaonIFeiHdJxhJQy3oNC-fB1I_9w4TMeGQ3SOTyf59bNvHh2IRKvqDIHQRGMC_PIfRpJuq_bwkFPauyXQWY9T1nQ"; String username = "******"; String pwd = "cmsgecg28"; YouTubeRequestSettings settings = new YouTubeRequestSettings("cms_app", developerKey, username, pwd); YouTubeRequest request = new YouTubeRequest(settings); Video newVideo = new Video(); newVideo.Title = title; newVideo.Tags.Add(new MediaCategory("Education", YouTubeNameTable.CategorySchema)); newVideo.Keywords = keyword; newVideo.Description = description; newVideo.YouTubeEntry.Private = false; newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122); newVideo.Tags.Add(new MediaCategory("CMS, GECG28", YouTubeNameTable.DeveloperTagSchema)); FormUploadToken token = request.CreateFormUploadToken(newVideo); return token; }