php - YOUTUBE API 中的 insertEntry 返回什么?

标签 php youtube youtube-api

这是我们使用 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/

相关文章:

php - python 格式日期时间与 "st", "nd", "rd", "th"(英文序数后缀),如 PHP 的 "S"

php - 合并 mysql 中的两个表以获得最近的事件功能

php - 使用更少代码的流畅界面

youtube - youtube not运算符无法通过gnip工作

java - 如何使用 YouTube API V2 获取可断点上传的响应?

php - 将 MySQL 数据导出到 Excel 矩阵

javascript - 使用javascript或jquery暂停youtube视频

button - 网站的YouTube按钮

youtube-api - 有什么方法可以提高YouTube API v3配额限制?

youtube-api - 通过 Youtube 数据 API v3.0 管理注释和卡片