문제

I'm trying to get a list of videos for a specific user with all the details for the video (title, desc., date, tags...) I can get pretty much everything I need, but can't figure out how to get the upload date. I tried using getVideoRecorded() and getRecorded(), but both return nothing.

I can't seem to find anything related to this on Google, all I can find is class references which tell me that I have to use getVideoRecorded or getRecorded, but nothing more.

Am I doing something wrong? how can I get the upload date?

Current code:

$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>";
                }
도움이 되었습니까?

해결책

You can try and extract the < published > or < updated > tags from the following xml:

http://gdata.youtube.com/feeds/api/videos/{$videoId}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top