我正在尝试获取特定用户的视频列表,其中包含视频的所有详细信息(标题,说明,日期,标签......) 我可以得到我需要的所有东西,但无法弄清楚如何获得上传日期。 我尝试使用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>";
}
答案 0 :(得分:0)
您可以尝试提取&lt;已发布&gt;或者&lt;已更新&gt;来自以下xml的标记:
http://gdata.youtube.com/feeds/api/videos/{$videoId}