I'm using this url:
https://www.googleapis.com/youtube/v3/playlistItems?
    playlistId=FLFe0SGNFqZ9E2owO5ZDZpeg&
    part=snippet,contentDetails,status
to fetch YouTube playlistItems.
I included all the part I'm interested in, however I found no way to return the duration of the item.
https://developers.google.com/youtube/v3/docs/playlistItems/list
Is this possible?
currently I'm getting back only an item like this:
{
  "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"
}, 
With no time indication at all. I'd rather avoid flooding YouTube with request to return a single video's duration.
Use link like this for get duration for many videos:
https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=idFirst,idSecond&key=YOUR_API_KEY
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With