Skip to content

Instantly share code, notes, and snippets.

@dftaiwo
Last active December 26, 2015 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dftaiwo/7131806 to your computer and use it in GitHub Desktop.
Save dftaiwo/7131806 to your computer and use it in GitHub Desktop.
Get YouTube Video Info
<?php
function _getYouTubeInfo($youtubeVideoId) {
require_once('Google_Client.php');
require_once('Google_YouTubeService.php');
$client = new Google_Client();
$youtubeClient = new Google_YouTubeService($client);
$listResponse = $youtubeClient->videos->listVideos("snippet", array('id' => $youtubeVideoId));
$videoList = $listResponse['items'];
if (empty($videoList)) {
return false;
}
$video = $videoList[0];
$videoSnippet = $video['snippet'];
return $videoSnippet;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment