Does v3 of the Youtube API let you get an Activity

2020-06-23 06:05发布

The default for a call to the activity feed is all types. It would be amazing if there was a way to filter by type so I could get a feed of just uploads. Is this possible?

https://www.googleapis.com/youtube/v3/activities?access_token=####&part=id,snippet,contentDetails&home=true&maxResults=50

标签: youtube-api
1条回答
一夜七次
2楼-- · 2020-06-23 06:28

If you're looking for uploads, you should actually make a call to the Channels resource to get the Uploads playlist, and then use PlaylistItems for your activity feed.

So to get the Google channel's uploads, make a call here:

https://www.googleapis.com/youtube/v3/channels?part=contentDetails&id=UCK8sQmJBp8GCxrOtXWBpyEA&key={YOUR_API_KEY}

You will find the playlist id (UUK8sQmJBp8GCxrOtXWBpyEA) here in the json response:

items -> contentDetails -> relatedPlaylists -> uploads

Then make a call to the PlaylistItems resource with "UUK8sQmJBp8GCxrOtXWBpyEA" set as the playlistId

https://www.googleapis.com/youtube/v3/playlistItems?part=id%2Csnippet%2CcontentDetails&maxResults=50&playlistId=UUK8sQmJBp8GCxrOtXWBpyEA&key={YOUR_API_KEY}

查看更多
登录 后发表回答