Open dseeker opened 9 years ago
This could help you out: https://github.com/stevenschobert/instafeed.js
You can use instagram's native method to paginate by passing options object before callback function.
Example:
function loadUserMedia() {
API.user.self.media({ count: 13 }, function (response) {
parseMedia(response);
});
}
function parseMedia (response) {
if (response.meta.code !== 200)
error(response);
if (response.data.length == 0)
return;
var lastMediaID, loadMoreBtn = $(/** **/);
for (var i = 0, media; media = response.data[i]; i++) {
lastMedia = media.id;
if (media.type == "video") continue; // remove if you want videos
// do your own stuff
images.add(/** **/);
}
if (response.pagination && response.pagination.next_max_id !== undefined) {
loadMoreBtn.removeClass('hidden');
loadMoreBtn.off('click').on('click.instagram.user.loadMore', function (e) {
e.preventDefault();
$(this).addClass('loading');
API.user.self.media({ count: 13, max_id: lastMedia }, function (response) {
parseMedia(response);
});
});
}
}
Is there a way to use pagination?
I'm trying to get all users who liked an item of media, is it just undocumented or not possible?