1

我正在尝试获取特定用户的视频列表,其中包含视频的所有详细信息(标题、描述、日期、标签......)我可以获得几乎所有我需要的东西,但无法弄清楚如何获取上传日期。我尝试使用 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>";
                }
4

1 回答 1

0

您可以尝试从以下 xml 中提取 <published> 或 <updated> 标签:

http://gdata.youtube.com/feeds/api/videos/{$videoId}
于 2013-05-03T20:21:58.723 回答