如何获取视频笔记使用youtube API v3?

时间:2017-02-11 08:13:57

标签: android playlist youtube-data-api

我有一个播放列表,我为视频添加了一些注释,您可以在下面的图像中看到黑色矩形。 如何请求Youtube API获取这些笔记?
目前我使用以下请求获取频道中的所有播放列表但我在响应中找不到注释信息。

  

https://www.googleapis.com/youtube/v3/playlists?part=snippet&channelId {频道ID}& key = {API key}

回应:

{
 "kind": "youtube#playlistListResponse",
 "etag": "\"uQc-MPTsstrHkQcRXL3IWLmeNsM/g2qkQQjXYxpAuIZDFpJ-DgzsO0c\"",
 "nextPageToken": "CAUQAA",
 "pageInfo": {
  "totalResults": 41,
  "resultsPerPage": 5
 },
 "items": [
  {
   "kind": "youtube#playlist",
   "etag": "\"uQc-MPTsstrHkQcRXL3IWLmeNsM/mugvLbe6Om6wVTC5e4IG53UGcN4\"",
   "id": "playlist Id",
   "snippet": {
    "publishedAt": "2017-02-16T07:08:41.000Z",
    "channelId": "UCVAG11iw9hQ-uexPa0_8xbA",
    "title": "abc",
    "description": "fdfdfdf",
    "thumbnails": {
     "default": {
      "url": "https://i.ytimg.com/vi/PD2iRNLzouc/default.jpg",
      "width": 120,
      "height": 90
     },
     "high": {
      "url": "https://i.ytimg.com/vi/PD2iRNLzouc/hqdefault.jpg",
      "width": 480,
      "height": 360
     }
   
    },
    "channelTitle": "abc",
    "localized": {
     "title": "abc",
     "description": "fdfdfdf"
    }
   }
  },

enter image description here

1 个答案:

答案 0 :(得分:-1)

参数应为playlistItems,而不是playlists

part参数应该是snippet,contentDetails而不只是snippetcontentDetails

对我有用的完整请求如下:

https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,contentDetails&playlistId=${PLAYLIST_ID}&key=${API_KEY}

参考:

Youtube API - Get notes from videos?