Add video to user's “Watch Later” playlist on YouTube

后端 未结 3 1929
野性不改
野性不改 2021-02-04 04:02

The aim is to create a Watch Later button using the YouTube API. When a user clicks the button, the video is saved into the user\'s Watch Later playlist. Simila

3条回答
  •  忘了有多久
    2021-02-04 04:48

    Retrieving "Watch Later" playlist:

    As pointed out by others, YouTube no longer allow this

    Adding a video to that same list is rather straight forward though:

    curl --request POST \
      'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&key=[YOUR_API_KEY]' \
      --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
      --header 'Accept: application/json' \
      --header 'Content-Type: application/json' \
      --data '{"snippet":{"playlistId":"WL","position":0,"resourceId":{"kind":"youtube#video","videoId":"M7FIvfx5J10"}}}' \
      --compressed
    

    You can find Javascript code snippet and more here: https://developers.google.com/youtube/v3/docs/playlistItems/insert

提交回复
热议问题