我正在尝试检索频道供稿中的喜欢和不喜欢的数量。但只得到了每个视频的评分。有没有办法从好恶中获取这些信息?
我的代码:
// set feed URL
$feedURL = "http://gdata.youtube.com/feeds/api/users/GoogleDevelopers/uploads";
// read feed into SimpleXML object
$sxml = simplexml_load_file($feedURL);
// get <gd:rating> node for video ratings
$gd = $entry->children('http://schemas.google.com/g/2005');
foreach ($sxml->entry as $entry) {
if ($gd->rating) {
$attrs = $gd->rating->attributes();
$rating = $attrs['average'];
}
/*
* does not work
*
$yt = $entry->children('http://gdata.youtube.com/schemas/2007');
$attrs = $yt->rating->attributes();
$dislikes = $attrs['numDislikes'];
$likes = $attrs['numLikes'];
*/
}
谁能帮我?