Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to do paging? #9

Open
furtivefelon opened this issue Oct 12, 2012 · 3 comments
Open

How to do paging? #9

furtivefelon opened this issue Oct 12, 2012 · 3 comments
Assignees

Comments

@furtivefelon
Copy link

Hey guys,

First of all thanks a lot for writing this incredibly useful piece of library!

I was just wondering for tags.recent{name:'blue'}), any approved way to do pagination? I understand for complete() callback, you can get the pagination url. However, is there a way of doing pagination within the confines of the library?

Thanks a lot!

Jason

@lincolnlemos
Copy link

Someone have this answer? I researched a lot about it and don't found anything.

@mckelvey mckelvey self-assigned this Mar 26, 2014
@mckelvey
Copy link
Owner

There isn’t a build in method for pagination, but that’s a great idea. I’ll put that on the roadmap.

@Amberlamps
Copy link

Even though there is no build-in method, you can easily enable pagination yourself:

var request = require('request');

Instagram.users.recent({
  user_id: 1032088109,
  count: 10,
  complete: getRecent
});

function getRecent(data, page) {

  // work with your data here

  if (page.hasOwnProperty('next_url')) {
    request(page['next_url'], function(err, response, body) {
      var body = JSON.parse(body);
      getRecent(body.data, body.pagination);
    });
  }

};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants