如何从 YouTube 网址中获取 YouTube 缩略图?

编程入门 行业动态 更新时间:2024-10-22 09:49:09
本文介绍了如何从 YouTube 网址中获取 YouTube 缩略图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在我的 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 缩略图?

本文发布于:2023-06-04 19:10:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/503367.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缩略图   网址   YouTube

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!