Real-time Instagram API not returning content identifiers?

Current scenario

I have an application that collects Instagram images from a specific hashtag. I use pagination to retrieve all images and store data (not images) locally in the database. The first application call removes all images. Subsequent calls are only collected by those that are newer than the newest image in the local database. Otherwise, I will need to make thousands of page requests through all the images in popular tags. And this needs to be done every few minutes if the images that appear without too much delay in the application. There is a problem: when users put tags on old images, these images are then not retrieved by my application - due to the performance design of just-select-new images.

Attempt to solve

I looked at the real-time API, but it seems to me that it is designed in such a way that makes it unacceptable. This is what it sends in real time to the tag:

{ "subscription_id": "2", "object": "tag", "object_id": "nofilter", "changed_aspect": "media", "time": 1297286541 } 

I would think that there would be a list of media identifiers representing new / changed content from which I could get the actual content - but it is not. My current solution is to get new content every few minutes and then do full rescans every hour. This is suboptimal from both the user and the performance perspective.

Question

Is it really impossible to do this in a more elegant way? I understand that Instagram does not send the full content to the update in real time, but sending identifiers should not be a problem in terms of the size of the payload. It seems that the API is useless in this respect - the only use case I can think of where it will be useful is "There is new content for you, hehtag to watch" nofications.

Best, Torbena

+4
source share
2 answers

What I do with the search for geography is that every time I get a service pack, I request the last geography endpoint. It works very well. Im assuming the idea of ​​subscribing to a tag is also, have you tried requesting the endpoint of the tags of the latest instagrams?

 /tags/[tag-name]/media/recent 
0
source

Separate the last media for the tag with the min_tag_id parameter to sort the result based on when it was tagged and not when the photo was taken. We use this in conjunction with the real-time api at silarapp.com , and it works great.

From Instagram Api Documenation (my emphasis):

Get a list of recently flagged content. Please note that this medium is ordered when this tag is tagged , not the one that was sent. Use the max_tag_id and min_tag_id parameters in the pagination response to paginate the page into these objects. May return a mixture of images and videos.

0
source

Source: https://habr.com/ru/post/1500272/


All Articles