How Does Instagram's GET/tags//media/recent Pagination Actually Work?

前端 未结 2 1449
情话喂你
情话喂你 2020-12-01 14:21

I\'m trying to use the Real-time Photo Updates API to get all pictures with a specific tag as they come in. Since updates from this API really only tell you that n

2条回答
  •  囚心锁ツ
    2020-12-01 14:41

    To get the newest set of grams for a particular tag, use this:

    https://api.instagram.com/v1/tags/latergram/media/recent?access_token=TOKEN
    

    From that response, you can get newer grams from the same tag by taking the min_tag_id from the response (under pagination) and build a url like so:

    https://api.instagram.com/v1/tags/latergram/media/recent?access_token=TOKEN&min_tag_id=1387332980547
    

    Or you can get the next (older) set of grams by using the next_url parameter from the original response (also under pagination), which looks like:

    https://api.instagram.com/v1/tags/latergram/media/recent?access_token=TOKEN&max_tag_id=1387332905573
    

    Make sure your subsequent queries (for new grams of a particular tag) are using the min_tag_id returned by the latest response. I did a few tests and didn't see duplicates, however I was using #latergram and that one has a high volume of posts

提交回复
热议问题