0
我用下面的PHP代碼,以獲得特定視頻的評論:的Youtube API - 視頻評論分頁
<?php
$vid = "G0k3kHtyoqc";
$feedURL = 'http://gdata.youtube.com/feeds/api/videos/' . $vid;
$entry = simplexml_load_file($feedURL);
$gd = $entry->children('http://schemas.google.com/g/2005');
if($gd->comments->feedLink){
$attrs = $gd->comments->feedLink->attributes();
$commentsURL = $attrs['href'];
$commentsCount = $attrs['countHint'];
}
if($commentsURL && $commentsCount > 0){
$commentsFeed = simplexml_load_file($commentsURL);
echo "<ol>";
foreach($commentsFeed->entry as $comment){
echo "<li>";
echo "<a target='_blank' href='http://www.youtube.com/user/" . $comment->author->name . "'>";
echo $comment->author->name;
echo "</a>";
echo " - " . $comment->content;
echo "</li>";
}
echo "</ol>";
}
?>
與上面的代碼的問題是,它只是變得最近24個評論。我需要一種方式來分析所有評論。
非常感謝您的幫助。
感謝