Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Efficient way to determine media deletion via Instagram API

Tags:

php

api

instagram

Currently I am calling Instagram API to get media with a certain #hastag. To make this process as efficient as possible and reduce calls to the API, data is cached on the server.

The purpose of this is to display some of the posts randomly on a website, but to respect the users privacy and Instagram rules, we need to get rid of the cached posts if it has been removed from Instagram.

The way I'm retrieving the media right now is calling the recent media endpoint for this tag each time my subscription alerts my app that there are updates.

So basically I need an efficient way to know if a post has been removed from Instagram, so that I can immediately remove it from my cache. I realize this can be done with a large number of calls to the API, but that's not ideal.

like image 947
chrisboustead Avatar asked May 15 '13 19:05

chrisboustead


People also ask

What information can I get from Instagram API?

The API can be used to get and publish their media, manage and reply to comments on their media, identify media where they have been @mentioned by other Instagram users, find hashtagged media, and get basic metadata and metrics about other Instagram Businesses and Creators.


1 Answers

When you save any of the original image/video url's you could periodically check whether this image still exists. If not, it's probably safe to assume that the original post has been removed. This way multiple API calls, are replaced by even more datacalls, but it should be a lot faster and no limits are enforced.

like image 121
Tom Lous Avatar answered Sep 19 '22 01:09

Tom Lous