Instagram Multi Hashtag Search

Find posts that match multiple hashtags or locations on Instagram

Share:  
Table of Contents

Find the IG posts that matter the most

This API will search for multiple hashtags and/or location on Instagram at the same time, then return the posts that match at least two of them.

For example, using #vegan and Paris France as input, you'll know who's talking about vegetables in the most beautiful city in the world!

To get your imagination going, here are some other examples:

  • #sponsored + #healthy: Healthy posts being sponsored on IG right now
  • #beach + #makeup: Makeup products that are beach-ready
  • #ootd + San Francisco California: Who's wearing what in SF today?

You get the idea! There is no limit to the number of hashtags you can use, so if you're feeling like a power user, put more than 2 :)

What will you need? ⚙️

  • List of hashtags and/or locations: Provide a list of hashtags beginning with # (like #phantombuster) or a locations (like New York) and the API will find the IG posts that match at least two of them
  • Session cookie (sessionid): Your Instagram sessionid session cookie (more info below)

Which steps to follow?

1. Create an account on Phantombuster.com 💻

If you haven't already, create a FREE account on Phantombuster. Our service will browse the web for you. It’s a website automator which runs in the cloud. Once done we'll follow up.

2. Use this API on your account.👌

Now that you're connected to Phantombuster, Click on the following button (it will open a new tab).

3. Click on Configure me!

You'll now see the 3 configuration dots blinking. Click on them.

4. Enter at least two hashtags/locations

In the 1st configuration field, you have to add at least 2 hashtags or locations so that the API can search for those terms in Instagram.

Hashtags and locations are differentiated by the presence of a # in front of the word. Successively enter either a hashtag beginning with # (example: #phantombuster) or a location (example: New York).

You can also enter a Google spreadsheet URL or a CSV with each line containing multiple hashtags or locations in a single cell, separated by commas (ex: 'New York, #selfie'). Each line will be treated as a single multi-hashtag search.

5. Get your Instagram session cookie

The session cookie you'll need to make this API work is called "sessionid",
Here's how you can get yours:

  • Using Chrome, go to your Instagram homepage and open the inspector
    → Right click anywhere on the page and select “Inspect”
    CMD+OPT+i on macOS
    or
    F12 or CTRL+MAJ+i on Windows

  • Locate the “Application” tab

  • Select “Cookies” > “https://www.instagram.com” on the left menu.

  • Locate the “sessionid” cookie.

  • Copy what’s under “Value” (Double click on it then Ctrl+C) and paste it into your script configuration

// How to access your cookies with Firefox and Safari //

Click on Launch & Enjoy!

It’s done! All that is left to do is to click on "launch" to try your script!

Limits

Instagram limits the number of requests you can do per hour, per account. We've found that in general, after doing a search for 5000 posts, the API will need to pause for at least 15min.

Output

This API will output CSV and/or JSON containing the following fields:

  • profileUrl (Profile URL of post author)
  • profileName (Instagram username of post author)
  • postUrl (Instagram post URL)
  • description (Post description)
  • pubDate (Post publication date)
  • likes (Number of likes the post received)
  • views (Number of views, if the post contains a video)
  • location (Where the photo was taken, if specified)
  • matches (Which hashtags or location lead to this post)
  • postVideo (Link to raw video file, can contains more than one link if the data is available)
  • videoThumbnail (Link to raw video thumbnail, if available)

Developers

Like all APIs on Phantombuster, this API comes with an HTTP endpoint. Launch it from your computer, app or server with a simple HTTP request and get its result as JSON. Click Use this API above to create your new endpoint.

Clone this API

The script below is all that's required to make the API work. If you're a developer, click the button to clone the code into a new Custom API Agent in your Phantombuster account. This operation will allow you to customize the API to your exact needs. This will also create a custom HTTP endpoint.

Contribute on GitHub

Feeling adventurous? Unsatisfied with the current state of this API? Send us pull requests on GitHub to improve the API store! The script is here and you might be interested in reading our documentation here

You can also edit the page you're reading right now

(we reward contributions we like with free Phantombuster accounts :D)

Share this API

Your friends & colleagues need to know about this!