Instagram Search Scraper avatar

Instagram Search Scraper

Pricing

from $4.00 / 1,000 results

Go to Apify Store
Instagram Search Scraper

Instagram Search Scraper

Search Instagram posts like the in-app search bar and scrape matching users, hashtags and places, optionally including each hashtag's posts.

Pricing

from $4.00 / 1,000 results

Rating

0.0

(0)

Developer

code gerald

code gerald

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 days ago

Last modified

Categories

Security

Limited permissions

Share

Search Instagram exactly like the in-app search bar and get structured results back: matching accounts, hashtags, places, and posts - plus, optionally, the posts under every matched hashtag.

What you get

Type in a search term the way you would in the Instagram app (e.g. travel, nasa, coffee shop) and this Actor returns:

  • Accounts that match the term, with username, full name, profile picture, verified/private status
  • Hashtags that match the term, with post counts
  • Places that match the term, with address and coordinates
  • Posts matched directly by keyword (the same results you'd see on the "Top" tab), with caption, media, likes, and comments
  • Optionally, the actual posts under every matched hashtag

Before you run it

This Actor needs a logged-in Instagram session to search (the same way you need to be logged in to use the search bar on instagram.com). If the Actor doesn't already have one configured, you'll need to supply your own in the sessionCookie input field:

  1. Use a secondary/throwaway Instagram account - not your main one. Automated searching can get an account temporarily restricted.
  2. Log in to instagram.com in a desktop browser.
  3. Open DevTools (F12) → Network tab, reload the page, click any request to www.instagram.com, and find the Cookie request header.
  4. Copy the entire value (it looks like sessionid=...; csrftoken=...; ds_user_id=...; mid=...; ig_did=...; ...) - not just the sessionid part, the search features need the full cookie to work reliably.
  5. Paste that whole string into the sessionCookie input field.

Cookies expire or get invalidated if you log out elsewhere, so grab a fresh one if runs start failing with a session error.

Input

FieldDescriptionDefault
searchQueriesList of terms to search, one per entry- (required)
searchTypesWhich result types to include: users, hashtags, places, postsall four
resultsLimitPerQueryMax matches kept per query, per type (1-100)20
includeHashtagPostsAlso scrape the posts under every matched hashtagoff
postsPerHashtagMax posts per hashtag when the above is on (1-1000)30
postedAfter / postedBeforeKeep only posts/reels published within this date range. Instagram's search has no native date filter, so this is applied client-side to post results only (accounts/hashtags/places are unaffected)-
sessionCookieYour Instagram cookie string (see above), if not already configured-
proxyConfigurationProxy settings; residential proxies recommendedApify residential proxy

Output

Results are stored in the default dataset, one item per row. The resultType field tells you what kind of row it is:

user

{ "resultType": "user", "query": "nasa", "name": "nasa", "fullName": "NASA", "url": "https://www.instagram.com/nasa/", "isVerified": true, "isPrivate": false }

hashtag

{ "resultType": "hashtag", "query": "travel", "name": "travel", "mediaCount": 650000000, "url": "https://www.instagram.com/explore/tags/travel/" }

place

{ "resultType": "place", "query": "paris", "name": "Paris, France", "address": "...", "lat": 48.8566, "lng": 2.3522, "url": "..." }

post (from posts search type or includeHashtagPosts)

{
"resultType": "post",
"query": "travel",
"shortCode": "Cx...",
"caption": "Chasing sunsets in Santorini 🌅 #travel #greece",
"hashtagsInCaption": ["travel", "greece"],
"mentionsInCaption": [],
"ownerUsername": "someuser",
"ownerFullName": "Some User",
"ownerIsVerified": false,
"likesCount": 1234,
"commentsCount": 56,
"viewsCount": null,
"locationName": "Santorini, Greece",
"isSponsored": false,
"displayUrl": "...",
"videoUrl": null
}

Posts also include timestamp, ownerId, ownerProfilePicUrl, isVideo, mediaType, productType, videoDuration, width, height, accessibilityCaption, isCommentsDisabled, and locationId.

If a query returns nothing on any of the selected tabs, you'll get an item with error and errorDescription instead, so you can tell a genuine empty result apart from a failed one.

Tips

  • Keep your query list and volumes moderate - aggressive automated searching is what gets accounts rate-limited or restricted by Instagram.
  • Usernames and hashtags never contain spaces or punctuation, so a query like econet 5g automatically retries as econet5g if the first attempt finds nothing.
  • If one result type (say, places) fails for a query, the others still come through - check the run log to see exactly which tab failed and why.
  • Instagram occasionally changes its internal response formats; if results suddenly stop appearing, that's usually the first sign and worth reporting.
  • Only public data is collected. Respect Instagram's Terms of Service and applicable data-protection laws when using the results.