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
,這樣也會識別 Google 的官方 YouTube 頻道。https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.activities.list? part=snippet,contentDetails &channelId=UCK8sQmJBp8GCxrOtXWBpyEA
擷取訂閱活動清單
訂閱活動是指與已驗證使用者訂閱的頻道相關聯的事件。如要擷取目前驗證使用者的訂閱活動清單,請呼叫 activities.list
方法,並將 home
參數值設為 true
。要求必須使用 OAuth 2.0 授權。
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.activities.list? part=snippet,contentDetails &home=true