I'm trying to get youtube video comments for a given video using PHP. I'm using Zend framework. Following is my code snippet
$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());
}
How can I get author's name/id, published time and other information for each comment? I couldn't find that information from Zend documentation.
Thanks in advance,
$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";
}
For the Vlogbrothers Feed:
http://gdata.youtube.com/feeds/api/videos/og8cxXICoVU/comments
A Sample comment entry
<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>