1
我試圖檢索頻道Feed中喜歡和不喜歡的內容。但只得到每個視頻的評分。有沒有什麼方法可以從喜歡和不喜歡中獲取這些信息?從YouTube頻道的上傳Feed中獲取喜歡/不喜歡的內容
我的代碼:
// 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'];
*/
}
誰能幫助我?
非常感謝你@Jeff Posnick 問題解決了! – Miguel 2013-04-23 18:49:23