我想在我的 React 应用中包含 YouTube 缩略图.
I want to include YouTube thumbnail inside my react app.
我已经在 developers google
这是我提出的要求
youtube.googleapis/youtube/v3/search?url=www.youtube/watch?v=6jypIrxqhXo&key=`HEREISTHEKEY`
问题是返回的数据没有缩略图图像数据.我在这里错过了什么,我必须做出什么改变才能恢复缩略图数据
The thing is The data coming back doesn't have the thumbsmail image data. What am I missing here , what change I have to make to get the thumbnail data back
推荐答案您需要添加 part=snippet 作为 url 参数:
You need to add part=snippet as an url parameter:
snippet 对象包含有关搜索结果的基本详细信息,例如其标题或描述.例如,如果搜索结果是视频,那么标题就是视频的标题,描述就是视频的描述.
The snippet object contains basic details about a search result, such as its title or description. For example, if the search result is a video, then the title will be the video's title and the description will be the video's description.
所以你的网址应该是这样的:
So your url should look like this:
youtube.googleapis/youtube/v3/search?url=www.youtube/watch?v=6jypIrxqhXo&part=snippet&key=YOURKEY
更多推荐
如何从 YouTube 网址中获取 YouTube 缩略图?
发布评论