# 如何从 Instagram 指定标签的公开帖子整理去重作者名单

[规范网址](https://social2api.com/guides/instagram-export-hashtag-authors/)

先访问 Social2api 的 Instagram 话题标签帖子接口，从返回帖子提取作者并保留原帖链接。用 author.id 去重，缺 ID 时只在账号名能对应到唯一已知 ID 的情况下合并。

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

## Agent 提示词

~~~~text
请用 Social2api 完成这个任务：如何从 Instagram 指定标签的公开帖子整理去重作者名单。
先请我确认输入（一个 Instagram 话题标签，是否需要补查公开资料或最近可见发帖日期）和愿意付费的请求数。使用此页列出的扩展 API 及参数。
只读取允许公开访问的数据，保留可复核的 ID、warnings 和缺失字段，按此格式交付：每名返回的公开作者保留一行，写出 author.id、author.username、示例作品链接。补查的公开资料、最近可见日期及取数时间可另外存列。。
如果 API 没有返回相应的公开数据，请保留缺失并解释覆盖范围。
https://social2api.com/guides/instagram-export-hashtag-authors/
~~~~

[查看 Instagram 话题标签帖子列表 API 的参数与示例](https://social2api.com/docs/api/catalog-instagram-hashtags-posts-list/)

## 本页用到的 Social2api 接口

| 接口与参数文档 | 用途 |
| --- | --- |
| [Instagram 话题标签帖子列表](https://social2api.com/docs/api/catalog-instagram-hashtags-posts-list/) · GET /v1/instagram/hashtags/posts/list | Instagram 话题标签帖子列表。返回一页 data.items，以及可用的下一页游标。 |
| [Instagram 用户详情](https://social2api.com/docs/api/catalog-instagram-users-get/) · GET /v1/instagram/users/get | Instagram 用户详情。返回一个 data.item 对象或 null。 |
| [Instagram 用户帖子列表](https://social2api.com/docs/api/catalog-instagram-users-posts-list/) · GET /v1/instagram/users/posts/list | Instagram 用户帖子列表。返回一页 data.items，以及可用的下一页游标。 |

## 准备输入并完成取数

1. 把话题标签传入标签帖子接口的 id，先核对返回帖文是否与标签相符。搜索账号名不能证明账号发过这个标签。
2. 翻页时先汇集匹配帖子，再统一核对作者。同一账号名对应一个已知 ID 时合并；对应多个 ID 时保留疑似冲突记录以供核对。每个作者保留一条来源链接。
3. 若需要公开简介，按 username 查用户详情。若要最近可见发帖日期，再取该账号自己的帖子列表，以有值的 published\_at 计算最大日期。

## 复制 Social2api 请求

在运行环境设置有 catalog 权限的 SOCIAL2API\_API\_KEY 和自己的 DATAXAPI\_API\_KEY。下方请求走 DataXAPI 通道，用公开示例输入展示可运行的请求，执行时会产生供应商请求。替换为自己的公开目标即可。

需要 Python 3。示例查一个标签的第一页，把去重后的 ID、用户名和作品链接写入 instagram-hashtag-authors.csv。补资料用该作者的 username 另查用户详情。

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

curl --fail-with-body --silent --show-error --get "https://social2api.com/v1/instagram/hashtags/posts/list" \
  --header "Authorization: Bearer $SOCIAL2API_API_KEY" \
  --header "X-DataXAPI-Key: $DATAXAPI_API_KEY" \
  --header 'X-Max-Price: 0.002' \
  --data-urlencode 'id=nasa' -o tag-page.json
python3 - <<'PY'
import csv, json
from collections import defaultdict
from pathlib import Path

response = json.loads(Path("tag-page.json").read_text(encoding="utf-8"))
posts = response.get("data", {}).get("items")
if response.get("code") != "ok" or not isinstance(posts, list):
    raise SystemExit("Unable to read hashtag posts; inspect tag-page.json.")

observations = []
ids_by_username = defaultdict(set)
for post in posts:
    author = post.get("author") or {}
    author_id = str(author.get("id") or "").strip()
    username = (author.get("username") or "").strip().casefold()
    if author_id or username:
        observations.append((author_id, username, post.get("url")))
        if author_id and username:
            ids_by_username[username].add(author_id)

authors = {}
for author_id, username, url in observations:
    known_ids = ids_by_username[username]
    if not author_id and len(known_ids) == 1:
        author_id = next(iter(known_ids))
    key = ("id", author_id) if author_id else ("username", username)
    status = "identity_conflict" if not author_id and len(known_ids) > 1 else "sample"
    existing = authors.get(key)
    if not existing or (url and not existing[2]):
        authors[key] = (author_id, username, url, status)

def spreadsheet_cell(value):
    if isinstance(value, str) and value.lstrip().startswith(("=", "+", "-", "@")):
        return "'" + value
    return value

with open("instagram-hashtag-authors.csv", "w", encoding="utf-8-sig", newline="") as output:
    writer = csv.writer(output)
    writer.writerow(["author_id", "username", "sample_post_url", "status"])
    writer.writerows([spreadsheet_cell(value) for value in row] for row in authors.values())
PY
~~~~

## 核对结果与覆盖

每名返回的公开作者保留一行，写出 author.id、author.username、示例作品链接。补查的公开资料、最近可见日期及取数时间可另外存列。

标签接口允许采样当前可返回的相关帖子，未提供任意历史日期区间或总人数。最近可见日期受实际读取页数、公开状态和置顶内容影响。

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

| 输入作者观察 | 处理结果 | 来源 |
| --- | --- | --- |
| ID 12 / Example；无 ID / example | 同一 ID，输出一行 | 保留一条标签帖子 URL |
| ID 36 / other；ID 71 / other；无 ID / other | 保留两个 ID 和一条 identity\_conflict | 各保留对应来源 |

## 核对分页和调用费用

先取一页标签再补 5 名作者的资料和各一页作品，共 11 次请求，DataXAPI 参考费用 US$0.022。仅需要作者名单时可以省去后续查询。

只在 page.has\_more 为 true 且存在 page.next\_cursor 时继续。下一页将该游标原样作为 cursor，继续使用相同查询和供应商。

上游费用从自己的 DataXAPI 账户结算，上游尝试会计入 Social2api 调用用量。展示价格以本站价格清单为准。

| 接口 | DataXAPI 通道参考价与上限 |
| --- | --- |
| [Instagram 话题标签帖子列表 API](https://social2api.com/docs/api/catalog-instagram-hashtags-posts-list/) | 每页最多 35 条，每页 US$0.002 |
| [Instagram 用户详情 API](https://social2api.com/docs/api/catalog-instagram-users-get/) | 每次 US$0.002 |
| [Instagram 用户帖子列表 API](https://social2api.com/docs/api/catalog-instagram-users-posts-list/) | 每页最多 12 条，每页 US$0.002 |

## 接口文档

- [Instagram 话题标签帖子列表 API](https://social2api.com/docs/api/catalog-instagram-hashtags-posts-list/)
- [Instagram 用户详情 API](https://social2api.com/docs/api/catalog-instagram-users-get/)
- [Instagram 用户帖子列表 API](https://social2api.com/docs/api/catalog-instagram-users-posts-list/)

## 参考来源

- [Social2api 扩展接口计费清单](https://social2api.com/pricing-catalog.json)

## 相关用户讨论

- [按 Instagram 标签找实际发帖者的需求](https://www.reddit.com/r/InstagramMarketing/comments/1k90r98/)
- [将标签作者去重后补公开资料与发帖日期的需求](https://www.reddit.com/r/api_connector/comments/ol60zd/)

## 相关指南和问答

- [如何导出一个公开 Instagram 账号的帖子说明文字](https://social2api.com/guides/instagram-export-public-profile-captions/)

[查看 Instagram 话题标签帖子列表 API 的参数与示例](https://social2api.com/docs/api/catalog-instagram-hashtags-posts-list/)
