Reputation: 97
I'm trying to find out a way to get share count for youtube video with for it id. reading Youtube API specification did not give any results. Can I get share count for video? On youtube site on video statistics this information is provided.
Upvotes: 2
Views: 1960
Reputation: 134
You may get it from YouTube Analytics API so far, based on the videoId, I created below a function in Google Apps Script for this data.
function videoShareCount(channelId,videoId) {
var today = new Date();
var startDate = YouTube.Videos.list('snippet',{id:videoId}).items[0].snippet.publishedAt;
var todayFormatted = Utilities.formatDate(today, 'UTC', 'yyyy-MM-dd')
var startDateFormatted = Utilities.formatDate(new Date(startDate), 'UTC', 'yyyy-MM-dd');
var analyticsResponse = YouTubeAnalytics.Reports.query(
'channel==' + channelId,
startDateFormatted,
todayFormatted,
'shares',
{
dimensions: 'video',
filters: 'video=='+videoId,
});
if (analyticsResponse.rows)
return analyticsResponse.rows[0][1];
else
return 0;
}
Upvotes: 1
Reputation: 2006
There isnt any Youtube APi methods to get the results.
Use social networking API's to get the results for the particular video's URL.
For example : http://youtu.be/g2QdJio6w64 - http://youtu.be/{VIDEO_ID}
After generating this URL,you can use different social networking api's to get count statistics.
For eg:http://www.sharedcount.com/#url=http%3A%2F%2Fyoutu.be%2Fg2QdJio6w64
Upvotes: 2
Reputation: 12877
This is not provided in Data API v3. But this request seems valid, so I'll file a feature request.
Feel free to file a feature request in public issue tracker to get updated on this issue.
Upvotes: 1