Instagram /v1/tags/{tag-name}/media/recent endpoint doesn't return min_tag_id in pagination block

后端 未结 2 1231
清歌不尽
清歌不尽 2020-12-13 15:09

According to https://www.instagram.com/developer/endpoints/tags/, we used to get the min_tag_id in the pagination part of the https://api.instagram.com/v1/t

相关标签:
2条回答
  • 2020-12-13 15:44

    It seems this was a temporary issue with the Instagram API and has now been resolved.

    0 讨论(0)
  • 2020-12-13 15:58

    So upon further investigation, I noticed that you can use the id of the newest post to effectively filter out older posts from the https://api.instagram.com/v1/tags/tag-name/media/recent?access_token=ACCESS-TOKEN response, which now always returns the last 20 posts.

    An id of a instagram post typically looks like xxxxxxxxxxxxxxxxxxx_yyyyyyyyyy where xxxxxxxxxxxxxxxxxxx is essentially the min_tag_id that used to be returned in the pagination block and yyyyyyyyyy is the user's id.

    So you can extract the xxxxxxxxxxxxxxxxxxx part of a post's id(xxxxxxxxxxxxxxxxxxx_yyyyyyyyyy) and do a comparison to see if it is larger than the previous xxxxxxxxxxxxxxxxxxx that you were keeping track of to retrieve newer posts.

    0 讨论(0)
提交回复
热议问题