Instagram Hashtag Scraper
Pricing
from $1.50 / 1,000 results
Instagram Hashtag Scraper
Scrape Instagram posts or reels for any hashtag: caption, author, likes, comment count, images, time and optional latest comments. Requires the cookies of your own Instagram account.
Pricing
from $1.50 / 1,000 results
Rating
5.0
(1)
Developer
Muhammad Noman Riaz
Maintained by CommunityActor stats
4
Bookmarked
128
Total users
1
Monthly active users
6 hours ago
Last modified
Categories
Share
Get Instagram posts or reels for any hashtag: caption, hashtags and mentions in the caption, author, likes, comment count, images, location, music info, time posted and, if you want, the latest comments of each post.
Cookies are required. Instagram only shows hashtag results to logged-in users (logged-out visitors are sent to the login page), so you must add the cookies of your own Instagram account. Use a secondary account, not your main one. See How to get your Instagram cookies.
What you get
Results come from Instagram's search results for #yourhashtag, the same list you see when you search the hashtag in the app.
{"inputUrl": "https://www.instagram.com/explore/search/keyword/?q=%23Interior_design_saudi","id": "3756182696478136272","type": "Image","shortCode": "DQgpELnDFfQ","caption": "...","hashtags": ["Interior_design_saudi"],"mentions": [],"url": "https://www.instagram.com/p/DQgpELnDFfQ/","commentsCount": 0,"firstComment": "","latestComments": [],"dimensionsHeight": 1594,"dimensionsWidth": 1277,"displayUrl": "https://scontent-...","images": [],"alt": null,"likesCount": 0,"timestamp": "2025-11-01T10:11:32.000Z","childPosts": [],"ownerFullName": "SAK","ownerUsername": "sakco.sa","ownerId": "78029144673","productType": "feed","isSponsored": true,"musicInfo": {"audio_canonical_id": "0","audio_type": null,"music_info": null,"original_sound_info": null,"pinned_media_ids": null}}
locationName and locationId are added when the post has a location. latestComments and firstComment are filled when maxComments is above 0.
Hashtags that fail (no results, rejected cookies, rate limits) are listed with the reason in FAILED_ITEMS in the run's key-value store.
Input
| Parameter | Type | Description | Default |
|---|---|---|---|
hashtags | Array | Hashtags, with or without # | Required |
cookies | Array | Your Instagram cookies, see below | Required |
resultsLimit | Integer | Max posts per hashtag (0 = no limit) | 50 |
resultsType | String | posts for all results, reels for reels only | posts |
maxComments | Integer | Latest comments to fetch per post (0 = skip) | 10 |
{"hashtags": ["webscraping", "coffee"],"resultsLimit": 100,"resultsType": "posts","maxComments": 5,"cookies": ["sessionid=...; ds_user_id=...; csrftoken=..."]}
How to get your Instagram cookies
- Use a secondary Instagram account, not your main one. Scraping can get an account rate-limited or asked to verify itself.
- In Chrome or Edge, log in to that account at https://www.instagram.com.
- Press F12 to open developer tools.
- Open the Application tab, then Storage, then Cookies, then https://www.instagram.com.
- Copy the values of
sessionid,ds_user_idandcsrftoken. - Put them in one line in this format:
sessionid=...; ds_user_id=...; csrftoken=... - Paste that line into the Instagram cookies field as a list item, for example
["sessionid=...; ds_user_id=...; csrftoken=..."].
Or, easier:
- Install the Cookie-Editor browser extension.
- Open https://www.instagram.com while logged in to your secondary account.
- Click the Cookie-Editor icon, then Export, then Export as JSON.
- Paste the result into the Instagram cookies field as is.
To rotate several accounts, add one entry per account, for example ["sessionid=...; ds_user_id=...; csrftoken=...", "sessionid=...; ds_user_id=...; csrftoken=..."], or a list of Cookie-Editor exports.
Good to know:
- Cookies work like a password. Anyone who has them can act as that account. Only paste them into this field.
- Apify stores this field encrypted, and the scraper never writes cookie values to the log.
- Cookies expire. When that happens, log in again and copy them again.
- Heavy use can rate-limit the account. Keep limits reasonable and spread work over several accounts.
- To revoke them, change the account password, or in Instagram open Settings, Accounts Center, Password and security, Where you're logged in, and log out of all sessions.
FAQ
Do I need cookies?
Yes. Instagram sends logged-out visitors of hashtag pages to the login page, and its search answers "page not found" without a login. The run stops right away with a message if the cookies field is empty or is missing sessionid, ds_user_id or csrftoken.
Why did my run fail with expired cookies?
The message "Your Instagram cookies expired or were rejected; refresh them" means Instagram answered with a login page, a 401, login_required or checkpoint_required. The session was logged out, expired or needs a security check. Log in to the account in your browser, clear any check Instagram shows, then copy fresh cookies. If you gave several sessions, the rejected one is dropped and the others keep working.
Is my account safe?
Use a secondary account. Instagram can rate-limit or challenge any account that loads many pages quickly, and that is outside this scraper's control. The cookies field is stored encrypted and its values are never logged.
How many comments can I get?
Up to maxComments of the latest comments per post, from the first page Instagram returns for that post. For full comment threads, use the Instagram Comments Scraper on the post URLs.
Notes
- Only public posts appear in hashtag results.
- Use the data in line with Instagram's terms and data protection laws (GDPR, CCPA and others).