Youtube API 获取视频长度和观看次数 [英] Youtube API get video length and views
问题描述
这可能吗?使用 Youtube API v3.0 获取视频长度和观看次数?我似乎无法找到任何内容,因为所有结果都是针对 v2.0 的.
Is this possible? Using Youtube API v3.0 to get video length and views? I can't seem to find anything on it as all the results are for v2.0.
推荐答案
搜索端点尚无法返回此信息,但如果您请求 contentDetails
和part
参数中的 statistics
......像这样:
The search endpoint doesn't have a way to return this info yet, but the videos endpoint can if you request the contentDetails
and the statistics
in the part
parameter ... something like this:
https://www.googleapis.com/youtube/v3/videos?part=contentDetails%2Cstatistics&id=voNEBqRZmBc&key={YOUR_API_KEY}
返回的对象将具有 ISO 8601 格式的 duration
属性(在 contentDetails 下),以及在统计信息下的 views
属性.
The returned object will have a duration
attribute that's in ISO 8601 format (under the contentDetails), and a views
attribute under the statistics.
这篇关于Youtube API 获取视频长度和观看次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!