Magento Developer
Magento Developer

Reputation: 23

Instagram feeds using tag name of particular user

I am trying to fetch the instagram feeds to my site using tag name. https://api.instagram.com/v1/tags/{tag-name}?access_token=ACCESS-TOKEN above is the api which I am using to get the feeds.

Now the feeds are displaying from all the users who use the tag. I need to restrict the feeds for the particular user who use the tag name.

Anyone come across this?

Thanks,

Upvotes: 1

Views: 1005

Answers (1)

Shiva
Shiva

Reputation: 20935

The current version of the Instagram Api does not have an endpoint that will allow you to get media by tag-name AND user-id. Your best bet is to use 1 of the following endpoints, and then loop through the results and filter out the media that matches the 2nd condition.

  1. Search for posts by given hashtag's name using GET /tags/{tag-name}/media/recent API endpoint request and then filter the response list of media to match the user-id for the particular user in question. or
  2. Search for posts by the particular user using GET /users/{user-id}/media/recent API endpoint request and then manually check every post if its tags array contains the specific hashtag you are looking for.

I recommend you go with option 2 as that will be faster, since an individual user feed is a much smaller data set than media from 1000s of Instagram users tagged with a hashtag.

Upvotes: 2

Related Questions