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

前端 未结 2 1448
情话喂你
情话喂你 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:31

    @zachallia has answered spot on, but I figure it can't hurt with a sketch:

    As the Instagram API says: MIN_TAG_ID Return media before this min_tag_id. MAX_TAG_ID Return media after this max_tag_id.

    This is counterintuitive, with a slightly nutty flavor. But still, it is possible to make sense of it.

    The /tags/MYTAG/media/recent endpoint will give you grams, ordered by how newly they where tagged with MYTAG. You'll not get all grams, of course, just up to the limit set by Instagram:

    |yesteryear ------------------ <---- LIMIT ----> now|
    

    If you use min_tag_id like so /tags/MYTAG/media/recent?min_tag_id=X you'll get grams from X and before (aka older):

    |yesteryear ------- <---- LIMIT ---> min ------- now|
    

    If you use max_tag_id like so /tags/MYTAG/media/recent?max_tag_id=Y you'll get grams from Y and after (aka newer):

    |yesteryear ------- max <---- LIMIT ---> ------- now|
    

    That's how "max" gets to signify "newer" and "min" gets to signify "older".

提交回复
热议问题