How can I get the information of how many views a certain video of YouTube has by providing the videoID of it using Java API
?
for example in the code sample that their provide they print different properties. How can I add printing the view Count?
Java code:
SearchResult singleVideo = iteratorSearchResults.next();
ResourceId rId = singleVideo.getId();
// Confirm that the result represents a video. Otherwise, the
// item will not contain a video ID.
if (rId.getKind().equals("youtube#video")) {
Thumbnail thumbnail = singleVideo.getSnippet().getThumbnails().getDefault();
System.out.println(" Video Id" + rId.getVideoId());
System.out.println(" Title: " + singleVideo.getSnippet().getTitle());
System.out.println(" Thumbnail: " + thumbnail.getUrl());
System.out.println("\n-------------------------------------------------------------\n");
here is a very similar question to mine, also unanswered:
Get ViewCount in Search.List - Youtube Data API v3
update 30/9: According to Youtube API tutorial the video resource may contain the following parts:
- snippet
- contentDetails
- fileDetails
- player
- processingDetails
- recordingDetails
- statistics
- status
- suggestions
- topicDetails
but in the SearchResult object only expose getSnippet() out of all of them
I also couldn't use a different part except the 'snippet' in the API Explorer that google provides.
So maybe all these statistics properties are not supported yet by API V3??