Skip to content

Instantly share code, notes, and snippets.

@jasongaylord
Created February 20, 2019 04:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongaylord/7e4b20296b87a760b57d24d11a152d4e to your computer and use it in GitHub Desktop.
Save jasongaylord/7e4b20296b87a760b57d24d11a152d4e to your computer and use it in GitHub Desktop.
YouTube API Connection
public List<Google.Apis.YouTube.v3.Data.SearchResult> LatestVideos()
{
var youTubeService = new YouTubeService(
new BaseClientService.Initializer() {
ApplicationName = "{Project}",
ApiKey = "{API_key}"
}
);
var listRequest = youTubeService.Search.List("snippet");
listRequest.ChannelId = "{Channel}";
listRequest.MaxResults = 5;
listRequest.Order = SearchResource.ListRequest.OrderEnum.Date;
listRequest.Type = "video";
var response = listRequest.Execute();
return response.Items.ToList();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment