Youtube API - How to limit results for pagination?
Posted
by worchyld
on Stack Overflow
See other posts from Stack Overflow
or by worchyld
Published on 2010-03-15T16:38:24Z
Indexed on
2010/03/15
16:39 UTC
Read the original article
Hit count: 707
zend
|youtube-api
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 '
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.
© Stack Overflow or respective owner