我如何检索“频道内的频道”在YouTube API v3上 [英] How can I retrieve "channels within a channel" on YouTube API v3

查看:325
本文介绍了我如何检索“频道内的频道”在YouTube API v3上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

YouTube频道可以包含多个相关频道列表。例如,音乐频道具有相关的流派频道:嘻哈,流行音乐,摇滚,国家等。

音乐频道: http://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ



音乐频道的相关频道: http://www.youtube .com / channel / UC-9-kyTW8ZkZNDHQJ6FgpwQ /频道



我可以使用 youtube检索频道内的视频列表.search.list API和我可以使用 youtube.channels.list API获取特定频道的数据,但我似乎无法找到任何API这给了我与渠道相关的其他渠道,就像上面的例子。



我很确定我看了所有的API谷歌提供的 https://developers.google.co m / apis-explorer /#p / youtube / v3 /

是否有我可以获取我需要的数据?$ b $在API中,您正在寻找的是

channelSections> ChannelSection 与类型 multipleChannels



使用您的音乐频道示例,I可以

<1> 拉所有channelSections



的列表

2)查找ID其类型为 multipleChannels 且标题为音乐流派的channelSection(链接示例底部的所有方式)。

3)使用步骤2中的ID,您现在可以查询该特定channelSection



在我的实施例I中使用为步骤1,它给你类型标题您也可以使用 contentDetails 作为将削减步骤的零件字段,但是您必须搜索 contentDetails 包含一个 channels 数组。



编辑:



要获得子频道的详细信息,您可以将频道ID作为逗号分隔列表一起使用,并将它们用作 id 参数一个 channels.list 查询。 这是一个查询,返回从步骤3返回的前3个频道的详细信息。


The YouTube channels can have lists of several "related" channels. For example, the Music channel has related Genre channels: Hip Hop, Pop, Rock, Country, etc.

Music Channel: http://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ

Related Channels to the Music Channel: http://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ/channels

I can retrieve a list of videos within a channel using the youtube.search.list API and I can fetch data of specific channels using youtube.channels.list API but I can't seem to find any API that gives me "other channels related to channel" like in the example above.

I'm pretty sure I took a look at all the APIs google is providing https://developers.google.com/apis-explorer/#p/youtube/v3/

Is there anyway I can fetch the data I need?

解决方案

In the API, what you are looking for is a ChannelSection with the type multipleChannels.

Using your example of the Music channel, I was able to

1) Pull a list of all channelSections

2) Find the id of the channelSection whose type is multipleChannels and title is Music Genres (all of the way at the bottom of the linked example).

3) Using the ID from step 2 you can now Query that specific channelSection

In my examples I used snippet for step 1 which gives you type and title. You could also use contentDetails for the part field which would cut down a step, but you'd have to search through the returned list whose contentDetails contained a channels array.

Edit:

To get details for the sub-channels you can join the channel IDs together as a comma separated list and use them as the id parameter in a channels.list query. Here is a query returning details for the top 3 channels returned from step 3.

这篇关于我如何检索“频道内的频道”在YouTube API v3上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆