问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/26777859/how-can-i-retrieve-channels-within-a-channel-on-youtube-api-v3