zend框架-使用PHP获取youtube视频评论细节


zend framework - Get youtube video comment details using PHP

我试图获得youtube视频评论使用PHP给定的视频。我正在使用Zend框架。下面是我的代码片段

$yt = new Zend_Gdata_Youtube();
$feeds = $yt->getVideoCommentFeed($id);  // $id is youtube id
while ($feeds) {
     foreach ($feeds as $idx => $feed) {
          echo $feed->getTitle()."'n"; // work and display the beginning of comment
          $author = $feed->getAuthor(); 
          // how to get author name and/or id?
          $date = $feed->getPublished();
          // how to get the date out if it?
     }
     $feeds = $yt->getVideoFeed($feeds->getNextLink());
}

如何获取每条评论的作者姓名/id、发表时间等信息?我在Zend文档中找不到那个信息。

提前致谢

$yt = new Zend_Gdata_YouTube();
$commentFeed = $yt->getVideoCommentFeed('abc123813abc');
foreach ($commentFeed as $commentEntry) {
    echo $commentEntry->title->text . "'n";
    echo $commentEntry->content->text . "'n";
    echo $commentEntry->author[0]->name->text. "'n";
    echo $commentEntry->author[0]->uri->text. "'n"; 
    echo $commentEntry->published->text. "'n";
}

对于Vlogbrothers Feed:

http://gdata.youtube.com/feeds/api/videos/og8cxXICoVU/comments

注释条目示例

<entry>
    <id>http://gdata.youtube.com/feeds/api/videos/og8cxXICoVU/comments/z13tuzmrbk2cszxbx04cjdcoyva4jjliu0c</id>
    <published>2014-03-09T20:16:01.000Z</published>
    <updated>2014-03-09T20:16:01.000Z</updated>
    <category scheme="http://schemas.google.com/g/2005#kind" term="http://gdata.youtube.com/schemas/2007#comment"/>
    <title type="text">i also highly ...</title>
    <content type="text">i also highly recommend Chop socky chooks- ninja chickens with a piece of 
wasabi as their arch nemesis.</content>
    <link rel="related" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/og8cxXICoVU"/>
    <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=og8cxXICoVU"/>
    <link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/og8cxXICoVU/comments/z13tuzmrbk2cszxbx04cjdcoyva4jjliu0c"/>
    <author>
      <name>Jade Collins</name>
      <uri>http://gdata.youtube.com/feeds/api/users/NGsitBKTSKzO-Fioyjy4dw</uri>
    </author>
    <yt:channelId>UCNGsitBKTSKzO-Fioyjy4dw</yt:channelId>
    <yt:googlePlusUserId>118173943933565439685</yt:googlePlusUserId>
    <yt:replyCount>0</yt:replyCount>
    <yt:videoid>og8cxXICoVU</yt:videoid>
  </entry>