1

Is there a way to call the Google Feed API so that it skips X number of entries in a feed?

To explain the context:

I'd like to load additional entries on demand from a particular feed. So a user can click a "Load more" type button, and an ajax function fires to retrieve additional entries. Just to put some numbers on the scenario, lets say I load 10 entries by default, and want to load an additional 10 each time a user clicks on a "load more" button.

With the historical entries / numEntries API functions, I can essentially solve my problem by retrieving 10 + ( number of entries already loaded ), and only output the last 10. But this is pretty ugly, because every time a user loads another 10 entries, they have to load ALL the previous entries as well, so the load gets larger everytime they load more entries. Seems pretty inefficient!

Inspecting the API docs at Google, I couldn't find any reference to a "skip entries", or "start from X entry" type of API method / variable, so I could make my ajax call nice and lean, and just get 10 entries, starting from ( number of entries already loaded).

Anybody have any experience / suggestions for me?

CodeLikeBeaker
  • 20,682
  • 14
  • 79
  • 108
ThomasNorth
  • 65
  • 2
  • 5

1 Answers1

0

I think you'll have to load all items first, but only display 10 at first. If they click "show more" you then show them the next 10 (you'll have to keep an internal pointer of your position in the list of items). So essentially, you aren't "loading" 10 more, you're "showing" 10 more.

Brian Pipa
  • 808
  • 9
  • 23
  • Yah I was afraid of that - probably not going to be an option though (there might be upward of a 150 feeds, so 150 * total_number_of_historical_entries = a big wad of loading time, even though I'm doing it asynchronously). Dang, the Google API abstracts so much difficult complexity (great!) but there's just a little bit of extra control I'd like :( – ThomasNorth Nov 16 '12 at 00:59
  • Ugh. Didn't realize it was that much. Agreed about the control. Yesterday I needed it to load a feed but NOT use the cached version - I don't see a way to do that. I posted a question about it: http://stackoverflow.com/questions/13401936 – Brian Pipa Nov 16 '12 at 13:05
  • Ah well I guess we ought to just thank the Google-Gods for opening up all their wondrous API's to start with (hard to imagine another company out there perfecting something as complex as Google Maps, and then making it available for other folks to build their own businesses on!). – ThomasNorth Nov 21 '12 at 03:25