Google Youtube API Search 不会检索频道中的所有视频 [英] Google Youtube API Search doesn't retrieve all videos in the channel

查看:56
本文介绍了Google Youtube API Search 不会检索频道中的所有视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用 Youtube API 检索我频道的所有视频.所有视频都发布在 Youtube 上,我可以正确看到它们.

I have to retrieve all video of my channel with Youtube API. All videos are published on Youtube and I can see them correctly.

我试图直接从这个页面提出请求:https://developers.google.com/youtube/v3/docs/search/list这是示例请求:获取 http s://www.googleapis.com/youtube/v3/search?part=snippet&channelId=myChannelID&maxResults=50&key={YOUR_API_KEY}

I tried to make the request directly from this page: https://developers.google.com/youtube/v3/docs/search/list and this is the example request: GET http s://www.googleapis.com/youtube/v3/search?part=snippet&channelId=myChannelID&maxResults=50&key={YOUR_API_KEY}

Request 不会检索所有视频,它只返回 9 个视频中的 7 个.所有视频都具有相同的配置.丢失的视频总是一样的.

Request doesn't retrieve all videos, it returns only 7 on the total of 9. All videos have the same configuration. Missing videos are always the same.

如果我使用视频 API 传递从搜索响应中排除的那些视频之一的 ID,它会返回正确的响应并且它正确地属于我的频道:https://developers.google.com/youtube/v3/docs/videos/list#try-it

If I use the video API passing the ID of one of those videos excluded from the search response, it returns a correct response and it belong correctly to my channel: https://developers.google.com/youtube/v3/docs/videos/list#try-it

有人可以帮助我吗?

先谢谢你

弗朗西斯科

推荐答案

如何使用 YouTube Data API v3 获取频道中所有视频的列表?"的答案此处可能正是您所需要的.请特别查看答案中链接的视频.

The answer to "How do I obtain a list of all videos in a channel using the YouTube Data API v3?" here may be what you need. Look especially at the video linked to in the answer.

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

To summarize, to get all the uploads from a channel, you need to get the items from the uploads playlist for the channel using playlistItems.list on that playlist's ID rather than calling search.list on the channel ID.

试试这个两步走的方法:

Try this two-step approach:

  1. 使用 channels.list API 调用获取您频道上传播放列表的 ID:GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&id={YOUR_CHANNEL_ID}&key={YOUR_API_KEY}
  2. 使用 playlistItems.list 调用从上传播放列表中获取视频:GET https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=3&playlistId={YOUR_PLAYLIST_ID}&key={YOUR_API_KEY}

这篇关于Google Youtube API Search 不会检索频道中的所有视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆