问题描述
某些频道的视频为零,即使这些频道上存在现有视频.但在某些频道上它运行良好.
Some of the channels giving zero videos result even though there are existing videos on those channels. But on some channels it's working fine.
这是不返回结果的通道示例.
Here is the channel example which is not returning result.
频道编号:UCsmyfPVdui2ZjOQSdM6CHWA
channel id: UCsmyfPVdui2ZjOQSdM6CHWA
我的问题是,youtube API v3 是否没有从非活动频道返回结果?或者这背后的原因是什么?在此先感谢您.
My question is, is youtube API v3 not returning result from inactive channels?Or what is the reason(s) behind this? Thank you so much in advance.
尝试阅读 youtube API 文档.但找不到与此问题相关的内容.
Tried to read youtube API docs. but can't find relating to this issue.
注意:这在某些频道上运行良好,但在某些频道上也不起作用.
NOTE: This is working fine on some channels and not working on some channels too.
推荐答案
无法确定为什么 search
请求对某些频道不起作用,但是,您可以尝试获取上传的视频通过使用youtube.playlistItems 从给定频道.列出"请求.
Can't say for sure why the search
request is not working with some channels, but, you can try get the uploaded videos from given channel by using the "youtube.playlistItems.list" request.
返回与 API 请求匹配的播放列表项的集合参数.您可以检索指定的所有播放列表项播放列表或通过唯一 ID 检索一个或多个播放列表项.
这是一个示例(使用您在问题中提供的channel_id
):
Here is an example (using the channel_id
you provided in your question):
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails%2Cstatus&playlistId=UUsmyfPVdui2ZjOQSdM6CHWA&fields=items(contentDetails%2FvideoId%2Csnippet(position%2Cthumbnails%2Ctitle)%2Cstatus)&key={YOUR_API_KEY}
在此请求中,我使用 uploads playlist id
从给定的 channel_id
检索上传的视频 - 您可以检查我的答案 了解更多信息.
In this request, I'm using the uploads playlist id
for retrieve the uploaded videos from a given channel_id
- you can check my answer for more information.
这是 Google API Explorer 演示,您可以在其中进一步测试.
Here is the Google API Explorer demo where you can test futher.
这篇关于无法检索某些频道的 YouTube 频道视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!