YouTube 即将弃用频道公告功能。因此,
activities.insert 方法将被
弃用,而 activities.list
方法将停止返回频道公告。这些变更将于 2020 年 5 月 18 日或
之后在 API 中生效。如需了解详情,请参阅
YouTube 帮助中心。
以下示例展示了如何使用 YouTube Data API (v3) 执行与用户活动相关的功能。
检索频道活动列表
如需检索与特定频道相关的事件列表,请使用以下两种方法之一来标识频道,然后调用 activities.list 方法:
-
将
mine参数值设置为true,以检索当前经过身份验证的用户的活动列表。您的请求必须使用 OAuth 2.0 进行授权。https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.activities.list? part=snippet,contentDetails &mine=true
-
将
channelId参数设置为 YouTube 频道 ID,该 ID 可唯一标识您要检索活动列表的频道。此示例将channelId参数设置为UCK8sQmJBp8GCxrOtXWBpyEA,该 ID 也标识了 Google 的官方 YouTube 频道。https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.activities.list? part=snippet,contentDetails &channelId=UCK8sQmJBp8GCxrOtXWBpyEA