json YouTube API:如何从带有标签 Y 的频道 X 获取视频?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5873185/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 17:50:29  来源:igfitidea点击:

YouTube API: How to get videos from channel X with tag Y?

jsonyoutube-api

提问by edt

For example, how could I get a JSON response of all the videos from channel "http://www.youtube.com/nba" that are tagged "playoffs"?

例如,如何从“http://www.youtube.com/nba”频道中获得所有标记为“季后赛”的视频的 JSON 响应?

采纳答案by AhmetB - Google

YouTube calls tagsas categories.

YouTube 调用tagscategories.

The following URL shows videos from NBAchannel with tags playoffsand sports(you can add more obviously) in JSON.

以下 URL以 JSON格式显示来自NBA带有标签playoffssports(您可以添加更明显的)频道的视频。

http://gdata.youtube.com/feeds/api/users/nba/uploads/-/sports/playoffs?v=2&alt=json

http://gdata.youtube.com/feeds/api/users/nba/uploads/-/sports/playoffs?v=2&alt=json

回答by yuli chika

Try something like this:

尝试这样的事情:

http://gdata.youtube.com/feeds/api/users/nba/uploads?q=playoffs

http://gdata.youtube.com/feeds/api/users/nba/uploads?q=playoffs

but this is xml format, look the api document and do it as json by yourself.

但这是xml格式,看api文档,自己做json。

回答by martnu

I think you're looking for the category-parameter. I ran a quick test to see how well it matches. Here's the result (yes, the page will load for a few seconds).

我认为您正在寻找 -category参数。我进行了一个快速测试,看看它的匹配程度。这是结果(是的,页面将加载几秒钟)。

  • This link will show you the results and how well they match 'playoffs' with the keywords, when using category.

  • This link will show you the results when using the q-parameter.

  • 此链接将向您显示使用类别时的结果以及它们与“季后赛”与关键字的匹配程度。

  • 此链接将显示使用 q 参数时的结果。

So, I guess the link you're looking for is:

所以,我猜你要找的链接是:

http://gdata.youtube.com/feeds/api/users/nba/uploads?category=playoffs&alt=json

http://gdata.youtube.com/feeds/api/users/nba/uploads?category=playoffs&alt=json