Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Returning duration while listing playlistItems?

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.

like image 330
John Smith Avatar asked May 07 '14 19:05

John Smith


1 Answers

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
like image 113
Max Avatar answered Sep 28 '22 04:09

Max