# 导出 Instagram 公开帖子评论与回复，用人工、页面工具还是 API？

[规范网址](https://social2api.com/compare/instagram-public-comments-export-api/)

用 Instagram 评论列表查公开帖，再用父评论的数字 ID 和原帖短码查回复。DataXAPI 通道的评论与回复不返回 post\_id，所以在发请求前要从原帖 /p/ 或 /reel/ 链接保存短码。

DataXAPI 价目生效日期与版本 [2026-11-25 · v22](https://social2api.com/pricing-catalog.json)

## Agent 提示词

~~~~text
用 Social2api 完成「导出 Instagram 公开帖子评论与回复，用人工、页面工具还是 API？」这项任务。
核对我提供的公开输入、所需输出字段和调用预算，尚缺输入时先询问。按页面列出的端点选择一次最小调用。只有我确认实时取数并配置所需密钥后才执行。
报告实际查询边界、取得的记录和缺失项，保留原始来源和采样时间。费用根据实际调用次数记录。
https://social2api.com/compare/instagram-public-comments-export-api/
~~~~

[读取 Instagram 帖子评论的接口文档](https://social2api.com/docs/api/catalog-instagram-posts-comments-list/)

## 按你要交付的结果选方法

| 做法 | 适合的任务 | 要核对的条件 |
| --- | --- | --- |
| 人工登记 | 少量评论，优先复核具体内容 | 核实评论是否参与活动、重复用户如何处理。 |
| 只取顶层评论 | 原帖互动采样或抽奖评论初筛 | 保留 comment\_id，可避免同一句正文被错误去重。 |
| 评论和回复分别调取 | 需要层级关系和可复查 CSV | 续页时保留父评论和帖子 ID。 |

## 对应的 Social2api 接口

| 接口 | 输入 | 交付结果 |
| --- | --- | --- |
| [读取 Instagram 帖子评论](https://social2api.com/docs/api/catalog-instagram-posts-comments-list/) · GET /v1/instagram/posts/comments/list | id 填短码或 url 填公开帖链接 | 评论每页最多 15 条。 |
| [读取父评论的回复](https://social2api.com/docs/api/catalog-instagram-comments-replies-list/) · GET /v1/instagram/comments/replies/list | id 填父评论的数字 ID，post\_id 填原帖短码 | 每页最多 15 条回复。 |

## 从输入到可以核对的交付

交付按帖子分组的 UTF-8 CSV，区分顶层评论与回复。缺失或停页的帖子单列。

1. **先取顶层评论**。 从原帖 URL 保存短码。每页保留评论原始 id、text、可用的 published\_at 和返回的游标。
2. **再取需要的回复**。 将父评论 id 与原帖短码 post\_id 送入回复端点。回复缺 parent\_id 时，CSV 可记录本次查询的父评论 ID 作为来源。
3. **导出并复核**。 保存 source\_shortcode、comment\_id、parent\_id、text、published\_at，注明哪些关联值取自请求。保留原始响应供复核。

## 最小调用示例

将有 catalog 权限的 Social2api API Key 和自带的 DataXAPI Key 分别放在 SOCIAL2API\_API\_KEY 和 DATAXAPI\_API\_KEY。示例的 X-Max-Price 固定 DataXAPI 通道，并限制每次费用。

先取一页顶层评论，有父评论 ID 时再取一页回复并合并成 CSV。下面预算另留一次顶层续页。若无父评论，保留响应以便复核。

~~~~bash
set -eu
: "${SOCIAL2API_API_KEY:?Set a Social2api catalog key}" "${DATAXAPI_API_KEY:?Set a DataXAPI key}"

POST_SHORTCODE=DeCPVhERA8e
curl -fsS --get 'https://social2api.com/v1/instagram/posts/comments/list' \
  -H "Authorization: Bearer $SOCIAL2API_API_KEY" \
  -H "X-DataXAPI-Key: $DATAXAPI_API_KEY" \
  -H 'X-Max-Price: 0.002' \
  --data-urlencode "id=$POST_SHORTCODE" > instagram-top.json
jq -e '.code == "ok"' instagram-top.json >/dev/null
PARENT_ID=$(jq -r 'first(.data.items[]? | .id | select(type == "string" and length > 0)) // empty' instagram-top.json)
if [ -n "$PARENT_ID" ]; then
curl -fsS --get 'https://social2api.com/v1/instagram/comments/replies/list' \
  -H "Authorization: Bearer $SOCIAL2API_API_KEY" \
  -H "X-DataXAPI-Key: $DATAXAPI_API_KEY" \
  -H 'X-Max-Price: 0.002' \
  --data-urlencode "id=$PARENT_ID" \
  --data-urlencode "post_id=$POST_SHORTCODE" > instagram-replies.json
jq -e '.code == "ok"' instagram-replies.json >/dev/null
  jq -rs --arg post "$POST_SHORTCODE" --arg parent "$PARENT_ID" '
    (["source_shortcode","comment_id","parent_id","text","published_at"] | @csv),
    (to_entries[] | .key as $batch | .value.data.items[] |
      [$post, .id, (if $batch == 1 then (.parent_id // $parent) else .parent_id end), .text, .published_at]
      | map(if type == "string" and test("^\\s*[=+@-]") then "\u0027" + . else . end) | @csv)
  ' instagram-top.json instagram-replies.json > instagram-comments.csv
else
  printf "%s\n" "No parent comment returned; saved instagram-top.json" >&2
fi
~~~~

## 输出样例（合成数据）

| source\_shortcode | comment\_id | parent\_id | 记录类型 |
| --- | --- | --- | --- |
| demo\_shortcode | 1001 | 空 | 顶层评论 |
| demo\_shortcode | 1002 | 1001 | 查询 1001 时取得的回复 |

## 这组样本要多少次调用？

按 DataXAPI 通道参考价，每个请求（包括每次续页）单独计算。示例安排 3 次请求。按每次上限估算，2 × 0.002 + 1 × 0.002 = 0.006 USD。

此估算按下表的调用次数计算，未包含额外翻页和重试。供应商费用在你的 DataXAPI 账户结算。

| 试跑任务 | 请求数 | DataXAPI 通道每次上限 |
| --- | --- | --- |
| 读取 Instagram 帖子评论 | 2 | 0.002 USD |
| 读取父评论的回复 | 1 | 0.002 USD |

## 用户在比较什么

- **Instagram 公开评论导出场景** 提问者在比较脚本与专用接口。 [Instagram 公开评论导出场景](https://www.reddit.com/r/scrapingtheweb/comments/1wxrdfv/)
- **抽奖帖评论整理的操作需求** 同一帖子上的多页评论需要可复查的输出。 [抽奖帖评论整理的操作需求](https://www.reddit.com/r/socialmedia/comments/1xrx4yb/)

## 常见问题

### 界面显示的评论总数能做 CSV 的预期行数吗？

界面计数可作为另一个字段保留。导出行数按本轮实际取到的不同评论和回复 ID 统计，两者可能因覆盖和可见状态而不同。

## 接口文档

- [读取 Instagram 帖子评论](https://social2api.com/docs/api/catalog-instagram-posts-comments-list/)
- [读取父评论的回复](https://social2api.com/docs/api/catalog-instagram-comments-replies-list/)
- [核对 DataXAPI 通道价目表](https://social2api.com/pricing-catalog.json)

## 参考来源

- [DataXAPI Instagram 评论字段](https://dataxapi.com/zh/apis/instagram/posts/comments/list/)
- [DataXAPI Instagram 回复的短码参数](https://dataxapi.com/zh/apis/instagram/comments/replies/list/)

## 相关用户讨论

- [Instagram 公开评论导出场景](https://www.reddit.com/r/scrapingtheweb/comments/1wxrdfv/)
- [抽奖帖评论整理的操作需求](https://www.reddit.com/r/socialmedia/comments/1xrx4yb/)

## 给 AI 代理

- [给 AI 的站点说明](https://social2api.com/zh/llms.txt)。 面向代理的功能概览与文档发现索引。
- [接入 AI 的步骤](https://social2api.com/zh/agents/)。 从免费试跑到 API Key 与 MCP 接入。
- [接入步骤（Markdown）](https://social2api.com/agents.md)。 接入指南的纯文本 Markdown 版本。
- [OpenAPI](https://social2api.com/openapi.json)。 查看 HTTP 请求参数、认证方式和响应结构。
- [价格表](https://social2api.com/prices.json)。 查看托管积分规则、扩展 API 报价和充值状态。
- [MCP 地址](https://social2api.com/docs/api/mcp/)。 Streamable HTTP 接入、授权方式和工具说明。

MCP Streamable HTTP 地址 `https://social2api.com/mcp`。

## 相关指南和问答

- [社媒数据 API 选型与对比](https://social2api.com/compare/)

[读取 Instagram 帖子评论的接口文档](https://social2api.com/docs/api/catalog-instagram-posts-comments-list/)
