Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram fetching tag recent user media after a max_id

Tags:

api

instagram

Lets asume I fetch recent user media for a tag... And that I am able of storing in a database the information that it is returned to me by the API.

The media ids are something like [0-9]+_[0-9]+, and lets asume that one day later, I want to fetch only new data, so I order the media, that I stored in my DB, by instagram's created time, then I select the one that its the newest and grab its id something like '121231232213123_12312312312'.

Then I use that Id as the max_id attribute for the API endpoint https://api.instagram.com/v1/tags/{tag_name}/media/recent, I would assume, that I would get new user_media or an empty array if no one had upload anything.

The thing is that I receive all the same data, its like if it not filtering my results nor using the max_id.

is this correct behavior or should I do something else?

thanks,

ps: I posted this same issue also on google groups:

https://groups.google.com/forum/?fromgroups#!topic/instagram-api-developers/QyjCORkjr3I

like image 717
chopi321 Avatar asked Jun 09 '13 13:06

chopi321


1 Answers

I found 2 tips, that can be useful for you:

  1. You should use min_id, in order to get new media. max_id will return photos, older that the one with this id.
  2. It's better to use live API in order to update your DB with new photos dynamically.

UPDATE:

Instagram live API is deprecated now. However you can now use webhooks subscription system which is very similar to facebook. Details can be found in this answer.

like image 168
Yaro Avatar answered Sep 28 '22 06:09

Yaro