YouTube API v3返回的视频长度与播放器显示的视频长度不同

时间:2018-08-22 07:12:17

标签: youtube-data-api

https://www.googleapis.com/youtube/v3/videos?id=7Bv_BWUmWN4&part=snippet,contentDetails&key=API-KEY

返回以下内容:

{
 "kind": "youtube#videoListResponse",
 "etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/JRQqvnK7AgxwkSXW6LtICD9MOeM\"",
 "pageInfo": {
  "totalResults": 1,
  "resultsPerPage": 1
 },
 "items": [
  {
   "kind": "youtube#video",
   "etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/5pNvbntKFoytd8cZKDHZjTZct-w\"",
   "id": "7Bv_BWUmWN4",
   "snippet": {
    "publishedAt": "2018-08-21T13:43:56.000Z",
    "channelId": "UC07F26kHKkpW_qqvXzEGALA",
    "title": "OMAROSA! A Randy Rainbow Song Parody",
    "description": "Featuring the voice and comedy talents of John Di Domenico: \nhttp://www.johnnyd.net/television-characters/donald-trump\n\n**SUBSCRIBE FOR THE LATEST RANDY RAINBOW VIDS!**\n\nBuy official t-shirts and other fun merch here: https://www.randyrainbow.com/shop\n\nCome see Randy Rainbow LIVE:\nhttps://www.randyrainbow.com/tour/\n\nSupport Randy's Patreon page and get lots of fun rewards: https://www.patreon.com/user?u=4881287\n\nLIKE Randy on Facebook for more: https://www.facebook.com/RandyRainbowOfficial\n\nFollow @RandyRainbow on TWITTER: https://twitter.com/RandyRainbow\n\nFollow @RandyRainbow on INSTAGRAM: https://instagram.com/randyrainbow/\n\nPlease Subscribe and check out RandyRainbow.com for more!",
    "thumbnails": {
     "default": {
      "url": "https://i.ytimg.com/vi/7Bv_BWUmWN4/default.jpg",
      "width": 120,
      "height": 90
     },
     "medium": {
      "url": "https://i.ytimg.com/vi/7Bv_BWUmWN4/mqdefault.jpg",
      "width": 320,
      "height": 180
     },
     "high": {
      "url": "https://i.ytimg.com/vi/7Bv_BWUmWN4/hqdefault.jpg",
      "width": 480,
      "height": 360
     },
     "standard": {
      "url": "https://i.ytimg.com/vi/7Bv_BWUmWN4/sddefault.jpg",
      "width": 640,
      "height": 480
     },
     "maxres": {
      "url": "https://i.ytimg.com/vi/7Bv_BWUmWN4/maxresdefault.jpg",
      "width": 1280,
      "height": 720
     }
    },
    "channelTitle": "Randy Rainbow",
    "tags": [
     "Randy Rainbow",
     "Oklahoma",
     "Omarosa",
     "Manigault",
     "Parody",
     "Funny",
     "Trump",
     "Broadway",
     "Musical",
     "Comedy"
    ],
    "categoryId": "24",
    "liveBroadcastContent": "none",
    "localized": {
     "title": "OMAROSA! A Randy Rainbow Song Parody",
     "description": "Featuring the voice and comedy talents of John Di Domenico: \nhttp://www.johnnyd.net/television-characters/donald-trump\n\n**SUBSCRIBE FOR THE LATEST RANDY RAINBOW VIDS!**\n\nBuy official t-shirts and other fun merch here: https://www.randyrainbow.com/shop\n\nCome see Randy Rainbow LIVE:\nhttps://www.randyrainbow.com/tour/\n\nSupport Randy's Patreon page and get lots of fun rewards: https://www.patreon.com/user?u=4881287\n\nLIKE Randy on Facebook for more: https://www.facebook.com/RandyRainbowOfficial\n\nFollow @RandyRainbow on TWITTER: https://twitter.com/RandyRainbow\n\nFollow @RandyRainbow on INSTAGRAM: https://instagram.com/randyrainbow/\n\nPlease Subscribe and check out RandyRainbow.com for more!"
    },
    "defaultAudioLanguage": "en"
   },
   "contentDetails": {
    "duration": "PT15S",
    "dimension": "2d",
    "definition": "hd",
    "caption": "false",
    "licensedContent": true,
    "projection": "rectangular"
   }
  }
 ]
}

因此,根据API,视频时长(duration)为15秒(PT15S)。但是,正确的视频长度是4:22:

https://youtu.be/7Bv_BWUmWN4

这是YouTube服务器上的错误,还是我们以错误的方式使用了API ??

0 个答案:

没有答案