开发者

How to get the totalResults entry from the YouTube video API

开发者 https://www.devze.com 2022-12-30 14:31 出处:网络
I\'m using PHP and the YouTube API to get videos from YouTube to feed to my web app, but I don\'t know how to get the totalResults entry

I'm using PHP and the YouTube API to get videos from YouTube to feed to my web app, but I don't know how to get the totalResults entry

Here is my code:

$yt = new Zend_Gdata_YouTube();
$query = $yt->newVideoQuery();
$query->setQuery($searchTerm);
$query->setStartIndex($startIndex);
$query->setMaxResults($maxResults);
开发者_开发百科$feed = $yt->getVideoFeed($query);

echo $feed->totalResults; // this desn't work


The element itself is protected; you need to use the getTotalResults accessor:

echo $feed->getTotalResults();
0

精彩评论

暂无评论...
验证码 换一张
取 消