这是我们使用 YouTube API 将视频上传到 YouTube 的方法。
$newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
上传后,如何获取刚刚上传的视频的唯一代码? 我的意思是,在网址中, http://www.youtube.com/watch?v=pBI3lc18k8Q
“pBI3lc18k8Q”是视频的唯一代码。那么,如何为我们刚刚上传的视频获取这个?
最佳答案
上传后执行此代码:
// 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() . "\n";
} else {
echo "Not able to retrieve the video status information yet. " .
"Please try again later.\n";
}
关于php - YOUTUBE API 中的 insertEntry 返回什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5038517/