Instagram Comments Scraper
Pricing
from $2.00 / 1,000 results
Instagram Comments Scraper
Scrape comments from public Instagram posts and reels: text, author, likes, time. Works without login for about 15 comments per post; add your own cookies to request more comments and replies.
Pricing
from $2.00 / 1,000 results
Rating
5.0
(1)
Developer
Muhammad Noman Riaz
Maintained by CommunityActor stats
2
Bookmarked
99
Total users
0
Monthly active users
14 days ago
Last modified
Categories
Share
Get the comments of public Instagram posts and reels: comment text, author username and ID, profile picture, likes, reply count and time posted.
Do you need cookies? No, not to start.
- Without cookies you get the first page of top-level comments that Instagram shows to logged-out visitors, which is about 15 comments per post. Replies are not included.
- With cookies from your own Instagram account the scraper can page through more comments and fetch replies (up to your limits).
What you get
| Field | Description |
|---|---|
postUrl | The post or reel the comment belongs to |
commentUrl | Direct link to the comment |
id | Comment ID |
text | Comment text |
ownerUsername, ownerProfilePicUrl | Who wrote it |
timestamp | When it was posted (ISO 8601) |
likesCount | Likes on the comment |
repliesCount, replies | Reply count and replies (replies only with cookies) |
parentCommentId | Only on replies |
owner | Author details: id, username, is_verified, profile_pic_url; with cookies also full_name, fbid_v2, is_private |
Example item:
{"postUrl": "https://www.instagram.com/p/CJWTsUMjjiM/","commentUrl": "https://www.instagram.com/p/CJWTsUMjjiM/c/18030198328749378","id": "18030198328749378","text": "Amazing post!","ownerUsername": "user123","ownerProfilePicUrl": "https://...","timestamp": "2024-03-10T13:24:37.000Z","repliesCount": 0,"replies": [],"likesCount": 1,"owner": {"fbid_v2": "","full_name": "","id": "48544088177","is_mentionable": true,"is_private": false,"is_verified": false,"latest_reel_media": 0,"profile_pic_id": "573323465","profile_pic_url": "https://...","username": "user123"}}
Only posts that return comments are saved and charged. Posts that fail (removed, private, no comments, rejected cookies) are listed with the reason in FAILED_ITEMS in the run's key-value store.
Input
| Parameter | Type | Description | Default |
|---|---|---|---|
directUrls | Array | Instagram post or reel URLs | Required |
resultsLimit | Integer | Max comments per post (0 = no limit) | 50 |
includeReplies | Boolean | Include replies (needs cookies) | true |
maxRepliesPerComment | Integer | Max replies per comment | 10 |
cookies | Array | Optional Instagram cookies, see below | None |
proxy | Object | Proxy for runs without cookies | Apify residential |
{"directUrls": ["https://www.instagram.com/p/CJWTsUMjjiM/","https://www.instagram.com/reel/DDIJAfeyemG/"],"resultsLimit": 100,"includeReplies": true,"maxRepliesPerComment": 20}
Without cookies the proxy matters: Instagram often shows a login wall to datacenter IPs, so residential proxies work best. With cookies, requests go out without the proxy so your account keeps one IP.
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?
No. Without cookies you get about 15 top-level comments per post and no replies. Add cookies when you need more comments or replies.
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?
Without cookies, about 15 per post: the first page Instagram shows to logged-out visitors. With cookies, up to resultsLimit per post (0 means no limit), plus up to maxRepliesPerComment replies per comment.
Notes
- Only comments on public posts and reels can be scraped.
- Use the data in line with Instagram's terms and data protection laws (GDPR, CCPA and others).