Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a list of the most recent videos uploaded to multiple YouTube channels?

I'm trying to get a list of the most recent videos uploaded to multiple YouTube channels in the order that they were uploaded. Sort of like how the subscription box on YouTube shows all of the recent videos uploaded by multiple people (that you are subscribed to).

GET https://www.googleapis.com/youtube/v3/search?
part=snippet&channelId=UC4XmzE3vYbp7h4B8dxcoN_A&maxResults=20&order=date
&key={YOUR_API_KEY}

That search will return a list of the most recent videos uploaded from a single channel. However, I'm trying to display a group of people within the same list.

GET https://www.googleapis.com/youtube/v3/search?
part=snippet
&channelId={UCXA7dMwWUS8n00Xq-Qvj38A,UC4XmzE3vYbp7h4B8dxcoN_A}
&maxResults=20&order=date&key={YOUR_API_KEY}

I've tried adding an additional YouTube channelId (separated by a comma) with the first one, and that seems to break the search and shows "random" videos (none from either channelId listed).

If anyone knows how to accomplish this with one API query, I'd be very happy.


To be more clear, as I mentioned in a comment below, this is what I'm looking to do:

I'm not trying to get a specific users "subscriptions", but instead I'm trying to combine multiple channels recent uploads (videos) into one list. This way I can display my "teams" videos in chronological order on my website in the order that they are uploaded.

like image 552
Josh Foskett Avatar asked Oct 01 '13 19:10

Josh Foskett


1 Answers

You can use activities->list call for this with home=true.

GET https://www.googleapis.com/youtube/v3/activities?part=snippet&home=true&key={YOUR_API_KEY}

Then you can filter only type=upload responses.

More info here.

But if you are looking for specific channels, there is no multichannel search, you can get uploads playlists from each channel and merge it yourself.

For each, do a channels->list request with channelId to get uploadsPlaylist then do a playlistItems->list with that playlistId to get items, you can stop adding items to your own list once publishedAt of that video is out of your boundary.

like image 157
Ibrahim Ulukaya Avatar answered Oct 17 '22 03:10

Ibrahim Ulukaya