YouTube API V3: Where can i find a list of each #39;videoCategoryId#39;?(YouTube API V3:在哪里可以找到每个“videoCategoryId的列表?)
问题描述
我使用的是 Youtube API V3,但找不到有关如何按类别过滤的文档:
I'm using the Youtube API V3 but can't find documentation for how to filter by category:
这是我的代码:
$results = $youtube->search->listSearch('id,snippet', array(
'q' => $_GET['q'],
'maxResults' => 20,
'type' => 'video'
'videoCategoryId' => 'what-do-i-put-here?',
));
我已经浏览了他们的文档一个小时,但似乎找不到任何关于我如何找出各种类别的 ID 的参考.就我而言,我正在寻找音乐的 videoCategoryId....
I've been going through their documentation for an hour and can't seem to find any reference to how I find out what the various category's ids are. In my case I'm looking for the videoCategoryId for music....
推荐答案
视频类别是特定于区域的——这就是类别列表服务需要类别 ID 或区域,但不能同时需要两者的原因.此端点:
Video categories are region specific -- that's why the category list service requires either a category ID or a region, but not both. This endpoint:
https://www.googleapis.com/youtube/v3/videoCategories?part=snippet®ionCode={two-character-region}&key={YOUR_API_KEY}
https://www.googleapis.com/youtube/v3/videoCategories?part=snippet®ionCode={two-character-region}&key={YOUR_API_KEY}
将返回给定区域的所有类别及其 ID.因此,正如 Ikai Lan 在评论中指出的那样,音乐的 ID 在美国是10",事实上,在所有允许此类别的地区;但可能有些地区不允许,或者有些地区根本不支持.
will return all categories, along with their ids, for a given region. So as Ikai Lan pointed out in the comments, the ID for music is '10' in the US and, in fact, in all regions where this category is allowed; but there may be some regions where it isn't allowed, or some regions that aren't supported at all.
这篇关于YouTube API V3:在哪里可以找到每个“videoCategoryId"的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:YouTube API V3:在哪里可以找到每个“videoCategoryId"的列表?


- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- PHP - if 语句中的倒序 2021-01-01