$query->maxResults not letting me set it high

5 messages Options
Embed this post
Permalink
Maceman

$query->maxResults not letting me set it high

Reply Threaded More More options
Print post
Permalink
If I set $query->maxResults too high then I get errors. And if I don't set it at all then I only get about 25 results, when I should be getting over 100.

How can I get more results?
Jochen Hartmann

Re: $query->maxResults not letting me set it high

Reply Threaded More More options
Print post
Permalink
Maceman,

What feed are you requesting? It may be easier to page 25 results at a time using the ->setStartIndex() method.

- j

On Mon, Mar 3, 2008 at 7:18 PM, Maceman <[hidden email]> wrote:

If I set $query->maxResults too high then I get errors. And if I don't set it
at all then I only get about 25 results, when I should be getting over 100.

How can I get more results?
--
View this message in context: http://www.nabble.com/%24query-%3EmaxResults-not-letting-me-set-it-high-tp15817497s16154p15817497.html
Sent from the Zend gdata mailing list archive at Nabble.com.


Maceman

Re: $query->maxResults not letting me set it high

Reply Threaded More More options
Print post
Permalink
It's a feed to get videos from a certain playlist. The playlist has over 100 videos and I would like to get them all at once to run a SQL query to add them to a database. But if I set the limit to say 100 then I get an error.

Jochen Hartmann wrote:
Maceman,

What feed are you requesting? It may be easier to page 25 results at a time
using the ->setStartIndex() method.

- j

On Mon, Mar 3, 2008 at 7:18 PM, Maceman <derek_dude12@yahoo.com> wrote:

>
> If I set $query->maxResults too high then I get errors. And if I don't set
> it
> at all then I only get about 25 results, when I should be getting over
> 100.
>
> How can I get more results?
> --
> View this message in context:
> http://www.nabble.com/%24query-%3EmaxResults-not-letting-me-set-it-high-tp15817497s16154p15817497.html
> Sent from the Zend gdata mailing list archive at Nabble.com.
>
>
Ryan Boyd-3

Re: $query->maxResults not letting me set it high

Reply Threaded More More options
Print post
Permalink
For performance consideration, some of the feeds are limited to a maximum value of 50 for max-results.

If you retrieve a feed and want to get the rest of the results, you can use the retrieveAllEntriesForFeed method.  This will paginate through the entire resultset -- performing as many GET requests as possible to retrieve each of the results. 

See below:
----
require_once 'Zend/Gdata/YouTube.php';
$yt = new Zend_Gdata_YouTube();

$playlistVideoFeed = $yt->getPlaylistVideoFeed("http://gdata.youtube.com/feeds/playlists/<playlist id>");
$playlistVideoFeed = $yt->retrieveAllEntriesForFeed($playlistVideoFeed);

foreach ($playlistVideoFeed as $entry) {
  echo $entry->title->text . "\n";
}
----

Cheers,
-Ryan



On Mon, Mar 3, 2008 at 5:03 PM, Maceman <[hidden email]> wrote:

It's a feed to get videos from a certain playlist. The playlist has over 100
videos and I would like to get them all at once to run a SQL query to add
them to a database. But if I set the limit to say 100 then I get an error.


Jochen Hartmann wrote:
>
> Maceman,
>
> What feed are you requesting? It may be easier to page 25 results at a
> time
> using the ->setStartIndex() method.
>
> - j
>
> On Mon, Mar 3, 2008 at 7:18 PM, Maceman <[hidden email]> wrote:
>
>>
>> If I set $query->maxResults too high then I get errors. And if I don't
>> set
>> it
>> at all then I only get about 25 results, when I should be getting over
>> 100.
>>
>> How can I get more results?
>> --
>> View this message in context:
>> http://www.nabble.com/%24query-%3EmaxResults-not-letting-me-set-it-high-tp15817497s16154p15817497.html
>> Sent from the Zend gdata mailing list archive at Nabble.com.
>>
>>
>
>

--
View this message in context: http://www.nabble.com/%24query-%3EmaxResults-not-letting-me-set-it-high-tp15817497s16154p15817899.html
Sent from the Zend gdata mailing list archive at Nabble.com.


Maceman

Re: $query->maxResults not letting me set it high

Reply Threaded More More options
Print post
Permalink
I decided to just keep moving ->setStartIndex() up. But for some reason it will only add 100 videos. If I try to add any more, even if I try to add only 1 at a time it won't work,

Ryan Boyd-3 wrote:
For performance consideration, some of the feeds are limited to a maximum
value of 50 for max-results.

If you retrieve a feed and want to get the rest of the results, you can use
the retrieveAllEntriesForFeed method.  This will paginate through the entire
resultset -- performing as many GET requests as possible to retrieve each of
the results.

See below:
----
require_once 'Zend/Gdata/YouTube.php';
$yt = new Zend_Gdata_YouTube();

$playlistVideoFeed = $yt->getPlaylistVideoFeed("
http://gdata.youtube.com/feeds/playlists/<playlist id>");
$playlistVideoFeed = $yt->retrieveAllEntriesForFeed($playlistVideoFeed);

foreach ($playlistVideoFeed as $entry) {
  echo $entry->title->text . "\n";
}
----

Cheers,
-Ryan



On Mon, Mar 3, 2008 at 5:03 PM, Maceman <derek_dude12@yahoo.com> wrote:

>
> It's a feed to get videos from a certain playlist. The playlist has over
> 100
> videos and I would like to get them all at once to run a SQL query to add
> them to a database. But if I set the limit to say 100 then I get an error.
>
>
> Jochen Hartmann wrote:
> >
> > Maceman,
> >
> > What feed are you requesting? It may be easier to page 25 results at a
> > time
> > using the ->setStartIndex() method.
> >
> > - j
> >
> > On Mon, Mar 3, 2008 at 7:18 PM, Maceman <derek_dude12@yahoo.com> wrote:
> >
> >>
> >> If I set $query->maxResults too high then I get errors. And if I don't
> >> set
> >> it
> >> at all then I only get about 25 results, when I should be getting over
> >> 100.
> >>
> >> How can I get more results?
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/%24query-%3EmaxResults-not-letting-me-set-it-high-tp15817497s16154p15817497.html
> >> Sent from the Zend gdata mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/%24query-%3EmaxResults-not-letting-me-set-it-high-tp15817497s16154p15817899.html
> Sent from the Zend gdata mailing list archive at Nabble.com.
>
>