public Google.Apis.YouTube.v3.YouTubeService GetApi(Account user) { var api = new Google.Apis.YouTube.v3.YouTubeService(new BaseClientService.Initializer() { ApplicationName = "Area", ApiKey = "473291186491-5tiqjh1gb7uoiv717utbf8ibjgcvfbj0", }); return(api); }
public YoutubeFeed() { _youtubeService = new YouTubeService( new BaseClientService.Initializer { ApiKey = "AIzaSyD0E4ozDor6cgdyQKHvOgLCrrQMEX226Qc", ApplicationName = "YouCast2", }); }
public YoutubeFeed(string applicationName, string apiKey) { _youtubeClient = new YoutubeClient(); _youtubeService = new YouTubeService( new BaseClientService.Initializer { ApiKey = apiKey, ApplicationName = applicationName }); }
public YoutubeFeed() { _youtubeService = new YouTubeService( new BaseClientService.Initializer { ApiKey = "AIzaSyD0E4ozDor6cgdyQKHvOgLCrrQMEX226Qc", ApplicationName = "YouCast2", }); _converter = new VideoConverter(); _downloader = new YoutubeVideoDownloader(_youtubeService); }
public YoutubeFeed() { _youtubeClient = new YoutubeClient(); _youtubeService = new YouTubeService( new BaseClientService.Initializer { ApiKey = "AIzaSyD0E4ozDor6cgdyQKHvOgLCrrQMEX226Qc", ApplicationName = "YouCast2", }); Logger.Info($"{nameof(YoutubeFeed)} created"); }
public YoutubeFeed() { _feedCache = new Cache <Arguments, SyndicationFeedFormatter>(15.Minutes()); _contentCache = new Cache <(string videoId, string encoding), string>(2.Hours()); _youtubeClient = new YoutubeClient(); _youtubeService = new YouTubeService( new BaseClientService.Initializer { ApiKey = "AIzaSyD0E4ozDor6cgdyQKHvOgLCrrQMEX226Qc", ApplicationName = "YouCast2", }); }
private async Task <IEnumerable <Google.Apis.YouTube.v3.Data.Video> > GetVideoInformation(string parts, string ids) { var service = new Google.Apis.YouTube.v3.YouTubeService(new BaseClientService.Initializer { ApplicationName = _appName, ApiKey = _apiKey, }); var videosRequest = service.Videos.List(parts); videosRequest.Id = ids; var videos = await videosRequest.ExecuteAsync(); return(videos.Items.AsEnumerable()); }
private async Task <IEnumerable <Channel> > GetChannelInformation(string parts, string ids) { var service = new Google.Apis.YouTube.v3.YouTubeService(new BaseClientService.Initializer { ApplicationName = _appName, ApiKey = _apiKey, }); var channelsRequest = service.Channels.List(parts); channelsRequest.Id = ids; var channels = await channelsRequest.ExecuteAsync(); return(channels.Items.AsEnumerable()); }
public YoutubeFeed(string applicationName, string apiKey) { _feedCache = new Cache <Arguments, SyndicationFeedFormatter>(15.Minutes()); _contentCache = new Cache <(string videoId, string encoding), string>(2.Hours()); _youtubeClient = new YoutubeClient(); _youtubeService = new YouTubeService( new BaseClientService.Initializer { ApiKey = apiKey, ApplicationName = applicationName }); }
private async Task <IEnumerable <Google.Apis.YouTube.v3.Data.Video> > GetPlaylistVideos(string playlistId) { var service = new Google.Apis.YouTube.v3.YouTubeService(new BaseClientService.Initializer { ApplicationName = _appName, ApiKey = _apiKey, }); var playlistVideos = service.PlaylistItems.List("contentDetails"); playlistVideos.Id = playlistId; var results = await playlistVideos.ExecuteAsync(); var videoIds = results.Items.Select(x => x.ContentDetails.VideoId); var idString = StringifyIds(videoIds); if (string.IsNullOrEmpty(idString)) { return(Enumerable.Empty <Google.Apis.YouTube.v3.Data.Video>()); } var videos = await GetVideoInformation("", idString); return(videos); }
public static string GetYTURLForMovie(Movie movie) { // https://www.youtube.com/embed/6vQgHBugHxA?autoplay=0 string url = ""; if (movie.Videos.Results.Count > 0) { foreach (var result in movie.Videos.Results) { if (result.Site == "YouTube") { url = "https://www.youtube.com/embed/" + result.Key + "?autoplay=0"; } } } if (url == "") { var youtubeService = new Google.Apis.YouTube.v3.YouTubeService(new BaseClientService.Initializer() { ApiKey = ConfigurationManager.AppSettings["APIKey"], ApplicationName = "DruMreLab1" }); var searchListRequest = youtubeService.Search.List("id, snippet"); searchListRequest.Q = movie.Title; // Replace with your search term. searchListRequest.MaxResults = 1; //you need to create the service object earlier var request = youtubeService.Videos.List("statistics,snippet"); // Call the search.list method to retrieve results matching the specified query term. var searchListResponse = searchListRequest.Execute(); List <string> videos = new List <string>(); //List<string> channels = new List<string>(); //List<string> playlists = new List<string>(); // Add each result to the appropriate list, and then display the lists of // matching videos, channels, and playlists. foreach (var searchResult in searchListResponse.Items) { switch (searchResult.Id.Kind) { case "youtube#video": request.Id = searchResult.Id.VideoId; var response = request.Execute(); foreach (var video in response.Items) { if (video.Statistics != null) { var count = video.Statistics.ViewCount; } } videos.Add("https://www.youtube.com/embed/" + searchResult.Id.VideoId + "?autoplay=0"); break; case "youtube#channel": //channels.Add(String.Format("{0} ({1})", searchResult.Snippet.Title, searchResult.Id.ChannelId)); break; case "youtube#playlist": //playlists.Add(String.Format("{0} ({1})", searchResult.Snippet.Title, searchResult.Id.PlaylistId)); break; } //Console.WriteLine(String.Format("Videos:\n{0}\n", string.Join("\n", videos))); //Console.WriteLine(String.Format("Channels:\n{0}\n", string.Join("\n", channels))); //Console.WriteLine(String.Format("Playlists:\n{0}\n", string.Join("\n", playlists))); return(videos[0]); } } return(url); }