gpt4 book ai didi

youtube - YouTube API v3搜索未返回所有视频

转载 作者:行者123 更新时间:2023-12-03 05:28:34 24 4
gpt4 key购买 nike

我正在尝试检索某个 channel 的所有视频,但api并未返回某些视频。我在规范中找不到任何可以指示为什么某些结果不在结果集中的内容。

我打的电话是:

https://www.googleapis.com/youtube/v3/search?type=video&key=__key_here__&channelId=UCxS2lX7728bTnmK1t21bYlA&part=id,snippet&maxResults=50&order=title

[要对此进行测试,您需要 your own api key]

结果的首页缺少至少一个视频。位于8-15-2018的一个名为 I LEARNED HOW TO DO A NEW TRICK!的文件位于此处,即使它在日期范围内,也不在结果集中,并且前50个结果。

有人知道这是否是已知问题吗?

我已验证,如果添加带有视频ID的q参数,它将检索它。

最佳答案

您可以引用此link

The API call that you should make if you want to get the videos in a channel is a youtube.playlistItems.list() with the playlistId of the "uploads" playlist for the channel. (This usually stars with UU..., but that's an implementation detail that might change in the future.

Here's an example of the call in the API Explorer.

Getting the same data via a search operation isn't guaranteed to return everything; the search index isn't a replacement for the backend data that you can obtain via the youtube.playlistItems.list() call. It's very much the same point raised in this blog post (though the focus there is on v2).


总而言之,要从某个 channel 获取所有上传内容,您需要使用该播放列表ID上的 playlistItems.list从该 channel 的上传播放列表中获取项目,而不是在该 channel ID上调用 search.list

关于youtube - YouTube API v3搜索未返回所有视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52808721/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com