2013-04-18 162 views
1

我想要獲取視頻的列表,包括視頻的所有詳細信息(標題,描述,日期,標籤...) 我可以獲得幾乎所有我需要的東西,但無法弄清楚如何獲取上傳日期。 我嘗試使用getVideoRecorded()和getRecorded(),但都沒有返回。使用Zend Gdata獲取視頻上傳日期Youtube API

我似乎無法在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

你可以嘗試從以下XML提取<報道>或<更新>標籤:

http://gdata.youtube.com/feeds/api/videos/{$videoId}