从YouTube获取图像 - 无法预测的403

发布于 2025-02-11 01:30:32 字数 1268 浏览 0 评论 0原文

我成功地从YouTube数据API获取了频道。

稍后,当我在我的反应组件中使用图像URL(频道配置文件的图像的图像)时,请使用一个名为“图像:

image={{src: source.content.image}}

我只获取一些图像:

“只显示了一些图像”

T Show给我:

我目前正在使用.medium选项

image: item.snippet.thumbnails.medium?.url.toString() || ""

最初获取时, 。 .DEFAULT带来同样的问题。

在某些日子里,我只在显示这些图像时只能得到几个403。在其他情况下,几乎每个图像URL都会导致403。 我也有这样的印象,即某些特定图像的显示可能性更高。例如上面搜索词“确定”的两个图像。 这是他们的URL: https://yt3.ggpht.com/ytc/ akedoltje9ob0hbwulnst_ebcgmuq9buu36epv8ko-hvbw = s240-ck-ck-c0x00fffffffffff no-rj https://yt3.ggpht.com/ytc/ akedoltpfapx-ckvivzqzwt2hcnamdmr3kgokmomm3erva = s240-ck-ck-c0x00ffffffffffffffff no-rj

I'm successfully fetching channels from the Youtube Data API.

Later, when I use the image urls (of the channel profile images) in my React components, using a prop named image:

image={{src: source.content.image}}

I'm only getting some of the images:

Only some images are displayed

The ones that don't show give me:
enter image description here

I'm currently using the .medium option

image: item.snippet.thumbnails.medium?.url.toString() || ""

when I fetch them initially.
.default brings the same issue.

On some days I only get a few 403s when displayling those images. On others almost every image url results in a 403.
I'm also under the impression, that some particular images have a higher chance of being shown. Such as the two images above for the search term "ok".
Here are their urls:
https://yt3.ggpht.com/ytc/AKedOLTJe9ob0HBWUlnST_EbCGMUq9buu36epv8KO-HVBw=s240-c-k-c0x00ffffff-no-rj
https://yt3.ggpht.com/ytc/AKedOLTPFApx-CKviVzQzWT2HCNAMDMr3KGOkmOMM3eRVA=s240-c-k-c0x00ffffff-no-rj

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文