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"的列表?
基础教程推荐
- PHP 类:全局变量作为类中的属性 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何替换eregi() 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
