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 是要擷取活動清單的頻道專屬 ID。這個範例將channelId參數設為UCK8sQmJBp8GCxrOtXWBpyEA,這也是 Google 官方 YouTube 頻道的 ID。https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.activities.list? part=snippet,contentDetails &channelId=UCK8sQmJBp8GCxrOtXWBpyEA