ofxInsagram pagination issue

Hey guys! Does anyone know how to deal with pagination in ofxInstagram? Instagram by default return 33 images from the API call… but I know there is a way to account for pagination and return back 100’s of images… has anyone done this with ofxInstagram ?

Thanks!

Hi Regina,

Not sure if there is another ofxInstagram. But if it’s the one I cobbled together, you should be able to specify the return number of images by setting count to the necessary value. Have plans to get pagination working soon though. Let me know how you get on.

David

Hi David! Thank you so much for the reply! Yes I am using your awesome add-on!

The issue I am having is that I define a variable num to be 100. Num is the number of images I would like to get back from Instagram. However instagram.getImageURL().size() is always 33. I can’t seem to make the URL size to be larger than 33. Do you have any suggestions?

      instagram.getListOfTaggedObjects("MetMuseum", num);
       

        
        if (!instagram.getImageURL().empty())
        {
            cout<<"this is"<<instagram.getImageURL().size();
            
            
            
            for ( int i = 0; i < instagram.getImageURL().size(); i++)
            {
                getImages.loadFromURL(images[i], instagram.getImageURL()[i]);
            }
        }

the json contains the “next_max_tag_id” which you can pull out with:

json["pagination"]["next_max_tag_id"].asString();

you can use the result of that as the max_tag_id for the next query, and use that one’s next_max_tag_id for the next one, and so on.

No worries.
@genekogan is spot on, hadn’t realised the limit was 33.

@ReginaFlores I’ll write something that manages that “id” now should be up in about an hourish

Hi Regina,

There is an example in the repo that lets you cycle through the paginated data. Its a bit basic but it does whats needed. Will try to make a better example at some point today.

Best

Thanks so much David and Gene! I will have some time later today to take a look at the revised source… appreciate your swift reply

1 Like