Alaouy\Youtube\Youtube::getVideoInfo PHP Method

getVideoInfo() public method

public getVideoInfo ( $vId, $part = ['id', 'snippet', 'contentDetails', 'player', 'statistics', 'status'] ) : StdClass
return StdClass
    public function getVideoInfo($vId, $part = ['id', 'snippet', 'contentDetails', 'player', 'statistics', 'status'])
    {
        $API_URL = $this->getApi('videos.list');
        $params = array('id' => is_array($vId) ? implode(',', $vId) : $vId, 'key' => $this->youtube_key, 'part' => implode(', ', $part));
        $apiData = $this->api_get($API_URL, $params);
        if (is_array($vId)) {
            return $this->decodeMultiple($apiData);
        }
        return $this->decodeSingle($apiData);
    }

Usage Example

 /**
  * Test skipped for now, since the API returns Error 500
  */
 public function testNotFoundAPICall()
 {
     $vID = 'Utn7NBtbHL4';
     //an deleted video
     $response = $this->youtube->getVideoInfo($vID);
     $this->assertFalse($response);
 }