-1

I need to get all post from(including post name,post image, author name, author image) based on some hash tags, for example if i use the hash tag world i need to get all post which have the hash tag WORLD. is it possible to do this ?

Many people may use the hash tag, so how can i get these things from several peoples?

i need to implement this on my magento 2 website.

FYI: Some time i have to use multiple hashtags like World, Worlds.

Can anyone help me on this?

1

You can get the posts in raw JSON by simply accessing this URL: https://www.instagram.com/explore/tags/{yourtag}/?__a=1

Example : https://www.instagram.com/explore/tags/summer/?__a=1

To access the posts check the variable: graphql.hashtag.edge_hashtag_to_media

To access the top posts check the variable: graphql.hashtag.edge_hashtag_to_top_posts

To get the post URL just use the following url: https://www.instagram.com/p/{shortcode}/

Example to get the first 6 posts:

$.get('https://www.instagram.com/explore/tags/summer/?__a=1', function (data, status) {
    for(var i = 0; i < 6; i++) {
        var $this = data.graphql.hashtag.edge_hashtag_to_media.edges[i].node;
        $('#container').append('<img src="'+  $this.thumbnail_resources[2].src +'">');
    }
});

Note:

Poorly designed Instagram database engine doesn’t allow us to filter posts by multiple tags. All third party sites claimed they can search with multi tags really search for one tag and than filter results for rest. It’s painfully slow and can hit the Instagram anti-bot ban, when you will loss the probability for search at all for some time.

Hope this helps.

To get the user details from Instagram, you have two options:

  1. Use the Instagram URL - https://www.instagram.com/{username}/?__a=1
  2. Use the Instagram API - https://api.instagram.com/v1/users/{user-id}

To use the Instagram API you need OAuth 2.0 Token provided by Instagram. Follow this URL to do the same - https://any-api.com/instagram_com/instagram_com/docs/API_Description

| improve this answer | |
  • Is there any option to get the user from the response ? I need to get the autor of each post which we get based on hashtag – amith lal Apr 28 at 5:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.