scraping-instagram-comments

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Scraping Instagram Comments

抓取Instagram评论

Raw data collection. No assumed use case — returns the full dataset for downstream analysis.

原始数据采集。不预设使用场景——返回完整数据集以供下游分析。

Inputs

输入参数

ParameterTypeRequiredDefaultNotes
startUrls
arrayOptional
[]
Instagram post URLs
postIds
arrayOptional
[]
Instagram post IDs
maxItems
numberOptionalUnlimitedMaximum comments to return
customMapFunction
stringOptionalJavaScript function to transform each output object
参数类型是否必填默认值说明
startUrls
array可选
[]
Instagram帖子URL
postIds
array可选
[]
Instagram帖子ID
maxItems
number可选无限制返回的最大评论数
customMapFunction
string可选用于转换每个输出对象的JavaScript函数

How to Run

运行方法

Using run_actor.js (recommended)

使用run_actor.js(推荐)

bash
undefined
bash
undefined

Quick 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
undefined
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
undefined

REST 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
call_actor
tool with actor
apidojo~instagram-comments-scraper
and the input above.

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}'
如果Apify MCP可用:使用Apify MCP的
call_actor
工具,指定actor为
apidojo~instagram-comments-scraper
并传入上述输入参数。

Output Fields

输出字段

FieldTypeDescription
postId
stringParent post ID
type
stringAlways
comment
id
stringComment ID
userId
stringCommenter user ID
message
stringComment text
createdAt
stringComment timestamp (ISO 8601)
likeCount
numberLikes on comment
replyCount
numberNumber of replies
user.id
stringCommenter ID
user.username
stringCommenter @username
user.fullName
stringCommenter full name
user.profilePicUrl
stringCommenter profile picture
isRanked
booleanWhether comment is ranked/top
字段类型描述
postId
string父帖子ID
type
string始终为
comment
id
string评论ID
userId
string评论者用户ID
message
string评论文本
createdAt
string评论时间戳(ISO 8601格式)
likeCount
number评论获赞数
replyCount
number回复数量
user.id
string评论者ID
user.username
string评论者@用户名
user.fullName
string评论者全名
user.profilePicUrl
string评论者头像URL
isRanked
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参数值,或在非高峰时段运行。