This is what we use to upload a Video to YouTube using YouTube API.
$newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
Once we upload, how can we get the unique code of the Video we just uploaded ?? What I mean is, in the url, http://www.youtube.com/watch?v=pBI3lc18k8Q
"pBI3lc18k8Q" is the unique code for the video. So, how to get this for the video we just uploaded??
Do this code after you upload it:
// Assuming that $videoEntry is the object that was returned during the upload
$state = $videoEntry->getVideoState();
if ($state) {
echo 'Upload status for video ID ' . $videoEntry->getVideoId() . ' is ' .
$state->getName() . ' - ' . $state->getText() . "
";
} else {
echo "Not able to retrieve the video status information yet. " .
"Please try again later.
";
}
You've got your unique code in $newEntry! ;)