Im using below code to retrieve recent youtube comments to a video:
<?php
$videoId='lWA2pjMjpBs';
$url="http://gdata.youtube.com/feeds/api/videos/{$videoId}/comments";
$comments=simplexml_load_file($url);
foreach($comments->entry as $comment)
{
echo '<fieldset>'.$comment->content.'</fieldset>';
}
?>
and i have 2 questions:
1) is there any way to limit number of comments, so I can display only example 10 comments?
2) is possible to exclude comments that are marked as spam?
Thanks.
I don’t know about the spam but you could limit the nr. of comments with a client-side solution like this:
haven’t checked this, but it should work. I hope this helped.