Youtube API - How to limit results for pagination?
- by worchyld
I want to grab a user's uploads (ie: BBC) and limit the output to 10 per page.
Whilst I can use the following URL:
http://gdata.youtube.com/feeds/api/users/bbc/uploads/?start-index=1&max-results=10
The above works okay.
I want to use the query method instead:
The Zend Framework docs:
http://framework.zend.com/manual/en/zend.gdata.youtube.html
State that I can retrieve videos uploaded by a user, but ideally I want to use the query method to limit the results for a pagination.
The query method is on the Zend framework docs (same page as before under the title 'Searching for videos by metadata') and is similar to this:
[code]
$yt = new Zend_Gdata_YouTube();
$query = $yt-newVideoQuery();
$query-setTime('today');
$query-setMaxResults(10);
$videoFeed = $yt-getUserUploads( NULL, $query );
// Output
print '';
foreach($videoFeed as $video):
print '' . $video-title . '';
endforeach;
print '';
[/code]
The problem is I can't do $query-setUser('bbc').
I tried setAuthor but this returns a totally different result.
Ideally, I want to use the query method to grab the results in a paginated fashion.
How do I use the $query method to set my limits for pagination?
Thanks.