Youtube Data API for PHP - Not getting any "publishAt" values -
i want track uploaded videos there scheduled date publishing. uploaded videos , filter them privacystatus "private" won't publishat values.
what do wrong?!
// call channels.list method retrieve information // authenticated user's channel. $channelsresponse = $youtube->channels->listchannels('contentdetails', array( 'mine' => 'true')); $htmlbody = ''; foreach ($channelsresponse['items'] $channel) { // extract unique playlist id identifies list of videos // uploaded channel, , call playlistitems.list method // retrieve list. $uploadslistid = $channel['contentdetails']['relatedplaylists']['uploads']; $playlistitemsresponse = $youtube->playlistitems->listplaylistitems('snippet', array( 'playlistid' => $uploadslistid, 'maxresults' => 50 )); $htmlbody .= "<h3>planned videos</h3><ul>"; //videos in list $uploadslistid foreach ($playlistitemsresponse['items'] $playlistitem) { $listresponse = $youtube->videos->listvideos('status', array('id' => $playlistitem['snippet']['resourceid']['videoid'])); $video = $listresponse[0]; $videostatus = $video['status']; // print private videos if ($videostatus->privacystatus == 'private') { $htmlbody .= sprintf('<li>%s (%s)</li>', $playlistitem['snippet']['title'], $videostatus['publishat']); } } $htmlbody .= '</ul>'; }
Comments
Post a Comment