Reputation: 1973
So how do I get posted videos from a channel that is "auto-generated by YouTube" (topic)? https://www.youtube.com/channel/UCSkJDgBGvNOEXSQl4YNjDtQ/videos
I can get topic ids from channel call but when I search by this topic ids I get a completely different results.
And if I run search api call with:
{
'part':'snippet',
'channelId':'UCSkJDgBGvNOEXSQl4YNjDtQ',
'topicId':'/m/03lty'
}
I get only playlists and channels. No video results.
Upvotes: 5
Views: 2096
Reputation: 177
You have to do this way:
call playlists endpoint and retrieve the id
GET https://www.googleapis.com/youtube/v3/playlists?part=id&channelId=UCSkJDgBGvNOEXSQl4YNjDtQ&maxResults=1&key={YOUR_API_KEY}
call playlistitems using the retrieved id
GET https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId={RETRIEVED_ID_COMES_HERE}&key={YOUR_API_KEY}
This works like a charm to me.
-- editing on March 27, 2016. You can also scrapy how search engine does. Just check the ToS and Policy.
Upvotes: 1
Reputation: 2795
Videos featured in an auto-generated channel are not created (uploaded) by this channel, so they don't show up in search results restricted to this channel id.
You can however get a list of videos associated with the topic by removing the channelId parameter.
EDIT: You can also do subsequent calls to retrieve videos for each playlist published by the auto-generated channel, with calls like this: https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.playlistItems.list?part=snippet&playlistId=PLfY-m4YMsF-OSodOIoTKPVblnYvdjU2Tn&_h=7&
Upvotes: 0