问题
I am wondering if there is a way that I can get statistics of other channels. I only can see the statistics of my videos. When I use other contentOwners or channels, it says it is forbidden.
Some of the statistics are for yourself like "Total viewcounts (and more) for all self-uploaded content" But some others like "Top 10 – Most watched videos for a content owner" should work for everyone, right?
Does anyone know the solution that how can I get statistics of different channels?
Thank You
回答1:
YouTube Analytics API is only for videos on your own channel, or, if you are a content owner, any of your channels or claimed videos. It reflects most of the data that you can see on https://www.youtube.com/analytics Likewise, that data is only available to yourself.
What is available though, is the "statistics" part of the YouTube Video API. Here you can get the data that's available on the watch page. For example:
GET https://www.googleapis.com/youtube/v3/videos?part=statistics&id=9bZkp7q19f0&key={YOUR_API_KEY}
Returns
{
"kind": "youtube#video",
"etag": "\"gMjDJfS6nsym0T-NKCXALC_u_rM/cCAW8VtIzXW5zJKDbjuP9BMWnt4\"",
"id": "9bZkp7q19f0",
"statistics": {
"viewCount": "2072823300",
"likeCount": "8559755",
"dislikeCount": "1090659",
"favoriteCount": "0",
"commentCount": "5247867"
}
}
Here is the reference to the YouTube API with a neat little "Try it" section in the bottom to play around with: https://developers.google.com/youtube/v3/docs/videos/list#try-it
来源:https://stackoverflow.com/questions/18835805/does-youtube-analytics-api-just-give-you-statistics-of-your-channel