3

It's possible to obtain public statistics of video?

Using something like this i can get just total views of video and like count:

https://www.googleapis.com/youtube/v3/videos?part=statistics&key=API_KEY&id=ekzHIouo8Q4

It's possible to get those public statistics? I found this question

Youtube GData API : Retrieving public statistics

But maybe something has changed?

Community
  • 1
  • 1
Yozer
  • 648
  • 1
  • 11
  • 26

3 Answers3

1

The only API call under Version 3 of the API that will get you statistics is the youtube.videos.list API

Try this API Explorer link to try:

https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?part=snippet%252C+statistics&id=Ys7-6_t7OEQ&maxResults=50&_h=2&

Hevski
  • 1,821
  • 1
  • 17
  • 26
1

You can get those using Analytics API

Sample requests would help you understand.

Analytics API is a different service but libraries come in same package and you can use same authorization with adding "https://www.googleapis.com/auth/yt-analytics.readonly" scope

Ibrahim Ulukaya
  • 12,767
  • 1
  • 33
  • 36
1

You would need to create YouTubeService object and can get search results for the keywords

YouTubeService youtubeService = new YouTubeService(new BaseClientService.Initializer()
{
  ApiKey = "dfhdufhdfahfujashfd",
  ApplicationName = this.GetType().ToString()
});

 var searchListRequest = youtubeService.Search.List("snippet");
      searchListRequest.Q = "cute cats"; 
      searchListRequest.MaxResults = 10;

  var searchListResponse = await searchListRequest.ExecuteAsync();
  var videoId = searchListResponse.Items.First().Id.VideoId is the unique id of the video

// Video Request    
VideosResource.ListRequest request = new VideosResource.ListRequest(youTubeService, "statistics")
{
  Id = videoId
};

VideoListResponse response = request.Execute();
if (response.Items.First() != null && response.Items.First().Statistics != null)
{
  Console.WriteLine(response.Items.First().Statistics.ViewCount);
}
skjagini
  • 3,142
  • 5
  • 34
  • 63