使用 Youtube API v3 从特定频道搜索视频 [英] Search videos from a specific channel with Youtube API v3
问题描述
在我的项目中,我尝试使用特定频道中的关键字进行搜索查询.在 Youtube API v3 的文档中,他们说要在特定频道中进行搜索,您需要将 channelId 放在查询中,但它似乎不起作用.
In my project I am trying to make a search query with keywords in a specific Channel. In the documentation of Youtube API v3, they say that to search in a specific channel you need to put the channelId in the query but it doesn't seem to work.
现在,我正在使用库iOS 版 YouTube Direct Lite"https://github.com/youtube/yt-direct-lite-iOS
Right now, I'm using the library "YouTube Direct Lite for iOS" https://github.com/youtube/yt-direct-lite-iOS
有谁知道使用这个库甚至是发出请求的 URL 进行我想要的搜索查询的正确方法是什么?
Does anybody know what is the right way to make a search query like I want with this library or even the URL to make the request?
GTLQueryYouTube *queryUpload = [GTLQueryYouTube queryForSearchListWithPart:@"id,snippet"];
queryUpload.channelId = CHANNEL_ID;
queryUpload.q = QUERY;
更新在 Google Developer Youtube API v3 上的 API 资源管理器上进行的测试非常好:(https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list)
UPDATE The tests work really fine made on the API explorer on the Google Developer Youtube API v3 : (https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list)
但是当我使用适用于 iOS 的 YouTube Direct Lite 库时,即使我设置了 channelId,它也会返回来自其他频道的视频.
BUT when I use the library YouTube Direct Lite for iOS, it returns videos from other channels even if I set the channelId.
谢谢
推荐答案
您遇到的错误是什么?您的查询对我来说很好用.更新:请再试一次,我相信之前有过中断.
What's the error you are getting? Your query works fine for me. UPDATE: Please try again, I believe there was an outage on this before.
您可以进一步指定 type=video 以仅获取视频作为响应.
You can further specify type=video to get only videos as response.
代码示例,您可以查看:https://github.com/youtube/yt-direct-lite-iOS
For code sample, you can check: https://github.com/youtube/yt-direct-lite-iOS
这篇关于使用 Youtube API v3 从特定频道搜索视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!