我正在使用以下网址:

https://www.googleapis.com/youtube/v3/playlistItems?
    playlistId=FLFe0SGNFqZ9E2owO5ZDZpeg&
    part=snippet,contentDetails,status

获取YouTube播放列表项。

我包括了我感兴趣的所有part,但是找不到返回该项目的duration的方法。

https://developers.google.com/youtube/v3/docs/playlistItems/list

这可能吗?

目前,我只找回这样的东西:
{
  "status": {
    "privacyStatus": "public"
  },
  "kind": "youtube#playlistItem",
  "contentDetails": {
    "videoId": "tL-Ba86UhoE"
  },
  "snippet": {
    "playlistId": "FLFe0SGeFqZ9E2owO5ZDZpwg",
    "thumbnails": {
      "default": {
        "url": "https://i1.ytimg.com/vi/tL-BA86Uhoh/default.jpg",
        "width": 120,
        "height": 90
      },
      "high": {
        "url": "https://i1.ytimg.com/vi/tL-BA86Uhoh/hqdefault.jpg",
        "width": 480,
        "height": 360
      },
      "medium": {
        "url": "https://i1.ytimg.com/vi/tL-BA86Uhoh/mqdefault.jpg",
        "width": 320,
        "height": 180
      }
    },
    "title": "Music Video",
    "resourceId": {
      "kind": "youtube#video",
      "videoId": "tL-BA86Uhoh"
    },
    "channelId": "UCFe0SGNFqZ9E2owO5ZDZpwg",
    "publishedAt": "2013-07-06T18:41:43.000Z",
    "channelTitle": "channeltitle",
    "position": 0,
    "description": "Video for"
  },
  "etag": "\"ePFRUfYBkeQ2ncpP9OLHvB0fDw4/CJiCG6tvFw4quQlzJq3gTrhvCNo\"",
  "id": "FL-fX6VqgtTfCJWKNE4aVRODKSrRgEdGvw"
},

根本没有时间指示。
我宁愿避免向YouTube发送要求返回单个视频的时长的请求。

最佳答案

使用这样的链接获取许多视频的时长:

https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=idFirst,idSecond&key=YOUR_API_KEY

关于youtube - 在列出播放列表项时返回持续时间?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23526728/

10-12 13:00
查看更多