如何使用视频 ID 获取 youtube 视频描述? [英] How to get youtube video description with video id?
问题描述
我目前正在使用 youtube 的 Javascript API 在我的网页上显示视频,但是现在我还想从视频 ID 中检索 youtube 描述?我该怎么做呢?
I am currently using the Javascript API by youtube to display a video on my web page however now I want to also retrieve the youtube description from the video id? How would I go about doing this?
我只想要描述和标题:
例如:
"kind": "youtube#video",
"etag": etag,
"id": string,
"snippet": {
"publishedAt": datetime,
"channelId": string,
"title": string,
"description": string,
"thumbnails": {
(key): {
"url": string,
"width": unsigned integer,
"height": unsigned integer
}
https://developers.google.com/youtube/v3/docs/videos
是否有人可以发布链接或向我展示有关如何完成此操作的代码示例?
If anyone could post a link or either show me an example of code on how I can accomplish this?
推荐答案
您链接到的开发人员文档有一些出色的代码示例——这将是最好的起点.使用视频的列表"参考菜单.
The developer documentation you linked to has some excellent code examples -- that'll be the best place to start. Use the "list" reference menu for videos.
如果您说您只想要标题和描述而不需要其他字段,您可以在请求中使用 fields 参数......像这样:
If you're saying that you just want the title and description without the other fields, you can use the fields parameter in your request ... something like this:
https://www.googleapis.com/youtube/v3/videos?part=snippet&id={VIDEO_ID}&fields=items/snippet/title,items/snippet/description&key={YOUR_API_KEY}
这篇关于如何使用视频 ID 获取 youtube 视频描述?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!