scraping-instagram-comments
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseScraping Instagram Comments
抓取Instagram评论
Raw data collection. No assumed use case — returns the full dataset for downstream analysis.
原始数据采集。不预设使用场景——返回完整数据集以供下游分析。
Inputs
输入参数
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| array | Optional | | Instagram post URLs |
| array | Optional | | Instagram post IDs |
| number | Optional | Unlimited | Maximum comments to return |
| string | Optional | — | JavaScript function to transform each output object |
| 参数 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| array | 可选 | | Instagram帖子URL |
| array | 可选 | | Instagram帖子ID |
| number | 可选 | 无限制 | 返回的最大评论数 |
| string | 可选 | — | 用于转换每个输出对象的JavaScript函数 |
How to Run
运行方法
Using run_actor.js (recommended)
使用run_actor.js(推荐)
bash
undefinedbash
undefinedQuick answer (table)
Quick answer (table)
node scripts/run_actor.js --actor "apidojo~instagram-comments-scraper" --input '{"startUrls": ["https://www.instagram.com/p/POSTCODE/"], "maxItems": 100}'
node scripts/run_actor.js --actor "apidojo~instagram-comments-scraper" --input '{"startUrls": ["https://www.instagram.com/p/POSTCODE/"], "maxItems": 100}'
Save as CSV
Save as CSV
node scripts/run_actor.js --actor "apidojo~instagram-comments-scraper" --input '{"startUrls": ["https://www.instagram.com/p/POSTCODE/"], "maxItems": 100}' --output results.csv --format csv
node scripts/run_actor.js --actor "apidojo~instagram-comments-scraper" --input '{"startUrls": ["https://www.instagram.com/p/POSTCODE/"], "maxItems": 100}' --output results.csv --format csv
Save as JSON
Save as JSON
node scripts/run_actor.js --actor "apidojo~instagram-comments-scraper" --input '{"startUrls": ["https://www.instagram.com/p/POSTCODE/"], "maxItems": 100}' --output results.json --format json
undefinednode scripts/run_actor.js --actor "apidojo~instagram-comments-scraper" --input '{"startUrls": ["https://www.instagram.com/p/POSTCODE/"], "maxItems": 100}' --output results.json --format json
undefinedREST API fallback
REST API备用方案
bash
curl -X POST "https://api.apify.com/v2/acts/apidojo~instagram-comments-scraper/runs" \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"startUrls": ["https://www.instagram.com/p/POSTCODE/"], "maxItems": 100}'If Apify MCP is available:
Use the Apify MCP tool with actor and the input above.
call_actorapidojo~instagram-comments-scraperbash
curl -X POST "https://api.apify.com/v2/acts/apidojo~instagram-comments-scraper/runs" \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"startUrls": ["https://www.instagram.com/p/POSTCODE/"], "maxItems": 100}'如果Apify MCP可用:使用Apify MCP的工具,指定actor为并传入上述输入参数。
call_actorapidojo~instagram-comments-scraperOutput Fields
输出字段
| Field | Type | Description |
|---|---|---|
| string | Parent post ID |
| string | Always |
| string | Comment ID |
| string | Commenter user ID |
| string | Comment text |
| string | Comment timestamp (ISO 8601) |
| number | Likes on comment |
| number | Number of replies |
| string | Commenter ID |
| string | Commenter @username |
| string | Commenter full name |
| string | Commenter profile picture |
| boolean | Whether comment is ranked/top |
| 字段 | 类型 | 描述 |
|---|---|---|
| string | 父帖子ID |
| string | 始终为 |
| string | 评论ID |
| string | 评论者用户ID |
| string | 评论文本 |
| string | 评论时间戳(ISO 8601格式) |
| number | 评论获赞数 |
| number | 回复数量 |
| string | 评论者ID |
| string | 评论者@用户名 |
| string | 评论者全名 |
| string | 评论者头像URL |
| boolean | 评论是否为热门/置顶评论 |
Edge Cases
边缘情况
- Private post: Returns 0 results. Tell user the post or account is private.
- Deleted post: Returns error. Verify URL is correct.
- Few comments: Normal — post may genuinely have low engagement.
- Missing fields: Some users may not have fullName or isVerified; handle gracefully.
- Rate limit: Reduce maxItems or run at off-peak time.
- 私密帖子:返回0条结果。需告知用户该帖子或账号为私密状态。
- 已删除帖子:返回错误。请验证URL是否正确。
- 评论数量少:属于正常情况——帖子可能确实互动量较低。
- 字段缺失:部分用户可能没有填写全名或未获得认证;需妥善处理。
- 速率限制:减少maxItems参数值,或在非高峰时段运行。