json 使用新 API v3 获取 youtube 视频信息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30506031/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Get youtube video info with new APIs v3
提问by Dag
Usually I retrieved clip's info by YouTube Data API V2, but now this version(v2) has been officially deprecated.
通常我通过 YouTube Data API V2 检索剪辑的信息,但现在这个版本 (v2) 已被正式弃用。
I used this URL to get video info:
我使用这个 URL 来获取视频信息:
'http://gdata.youtube.com/feeds/api/videos/'+ VIDEO_ID +'?v=2&alt=jsonc'
How to get info for a video in JSON format with new APIs v3?
如何使用新 API v3 获取 JSON 格式的视频信息?
回答by StackRewind
Depending on the information you should be able to use the following endpoint to gain the information about the video you require. Just filter it down using the id query parameter to the video id.
根据信息,您应该能够使用以下端点来获取有关您需要的视频的信息。只需使用视频 ID 的 id 查询参数对其进行过滤即可。
https://developers.google.com/youtube/v3/docs/videos/list
https://developers.google.com/youtube/v3/docs/videos/list
See the Below URL: for example using the video id 4Y4YSpF6d6w and setting part to id,snippet you will receive channelId, title, description, tags, and categoryId properties. The above documentation contains all of the part parameters depending on the information you require about the video.
请参阅以下 URL:例如,使用视频 ID 4Y4YSpF6d6w 并将部分设置为 id,snippet,您将收到 channelId、标题、描述、标签和 categoryId 属性。上述文档包含所有部件参数,具体取决于您需要的有关视频的信息。
GET https://www.googleapis.com/youtube/v3/videos?part=id%2C+snippet&id=4Y4YSpF6d6w&key={YOUR_API_KEY}
获取https://www.googleapis.com/youtube/v3/videos?part=id%2C+snippet&id=4Y4YSpF6d6w&key={YOUR_API_KEY}

