【发布时间】:2013-04-18 07:04:24
【问题描述】:
我正在尝试获取特定用户的视频列表,其中包含视频的所有详细信息(标题、描述、日期、标签...) 我几乎可以得到我需要的一切,但不知道如何获得上传日期。 我尝试使用 getVideoRecorded() 和 getRecorded(),但都没有返回任何内容。
我似乎无法在 Google 上找到与此相关的任何内容,我只能找到告诉我必须使用 getVideoRecorded 或 getRecorded 的类引用,但仅此而已。
我做错了吗?如何获取上传日期?
当前代码:
$authenticationURL= 'https://www.google.com/accounts/ClientLogin';
$httpClient =
Zend_Gdata_ClientLogin::getHttpClient(
$username = $yt_username,
$password = $yt_password,
$service = 'youtube',
$client = null,
$source = '', // a short string identifying your application
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);
$yt = new Zend_Gdata_YouTube($httpClient);
$feed = $yt->getUserUploads($yt_username);
foreach($feed as $item)
{
echo "<div>";
echo "<h4>title: " . $item->getVideoTitle() . "</h4>";
echo "<p>id: " . $item->getVideoId() . " | ";
echo "upload date: " . $item->getVideoRecorded() . "</p>";
echo "<p>description: " . $item->getVideoDescription() . "</p>";
echo "<p>tags: " . implode(", ", $item->getVideoTags()) . "</p>";
echo "</div>";
echo "<hr>";
}
【问题讨论】:
标签: php youtube youtube-api zend-gdata