Andrei Hubarevich
Andrei Hubarevich

Reputation: 23

Retrieve Instagram media by hashtag

I'm trying to fetch Instagram posts tagged with some concrete #hashtag to build a custom feed in my app.

This was possible using legacy API: https://www.instagram.com/developer/endpoints/tags/. However, according to developer documentation, Instagram deprecates its own API in favour of new Graph API. I don't see any direct replacement for this. The closest thing is the "Mentions API" (https://developers.facebook.com/docs/instagram-api/mentions) from which you can obtain media where your company has been mentioned (via @company in a comment/caption or by mentioning company name on a photo itself).

So, is there any viable alternative to the legacy API to obtain user media tagged with #hastag or it's officially forbidden now?

Thanks in advance.

Upvotes: 2

Views: 4310

Answers (1)

Krystian
Krystian

Reputation: 1026

As far as I know there is no reliable way to reproduce getting pictures by tag. Please keep in mind that new Graph API is dedicated only to Instagram Business Accounts. It will not work with regular Instagram accounts.

Another thing is that /tag endpoints in old Instagram API requires public_content permission. Unfortunately submitting new apps with this feature is forbidden - https://www.instagram.com/developer/changelog/. Right now for old Instagram API you can use basic permission only.

The only way IMHO is to scrape content of tag page by script running on your server. However this is not ideal solution and should be avoided. Too many requests can result in blocking your server IP.

Update 24.04.2019

Instagram Graph API now includes the Hashtag Search API so you can get pictures by tag. Docs for this functionality can be found here: https://developers.facebook.com/docs/instagram-api/hashtag-search

Upvotes: 2

Related Questions