关于 instagram-api
instagram-api 是通过 HTTP GET 接口获取 Instagram 个人资料、帖子、Reels、快拍及相关数据的技能,适用于需要按需检索 Instagram 数据的开发者和 Agent。它还提供 MCP 端点,支持免费发现工具和付费数据查询。
主要功能
- 01个人资料查询与搜索
- 02获取帖子、Reels 和快拍
- 03获取粉丝与关注对象
- 04搜索话题标签和地点动态
- 05获取评论及音频关联帖子
- 06包含 16 个端点的 HTTP GET API
适用场景
- 01按账号名或关键词查找个人资料
- 02监测话题标签或地点下的帖子和 Reels
- 03获取帖子及其评论
- 04收集账号的粉丝和关注对象
MCP 相关
提供 `https://instagram.fetcher.sh/mcp` MCP 端点。MCP 客户端可免费发现端点,并通过预付额度或 x402 按次付费调用数据查询工具。
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ fetcher-sh/ fetcher-skills --skill instagram-api安装后在 Claude Code 中输入/instagram-api确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/comparison.mdendpoints.mdfaq.mdscenarios.md详细介绍
Instagram API
按需获取 Instagram 数据:通过 @handle 查询个人主页、帖子、Reels、快拍、带标签的帖子、粉丝和关注对象、话题标签和地点动态、音频/音乐动态,以及帖子评论——每次调用只需发送一个普通 HTTP GET 请求,按使用量付费。无需登录、会话 Cookie、无头浏览器,也无需通过 Graph API 商业验证。
基础 URL:https://instagram.fetcher.sh
快速参考
| 基础 URL | https://instagram.fetcher.sh |
| 身份验证 | Authorization: Bearer bby_live_... 或 x402(USDC) |
| 价格 | 每次调用 $0.004(固定) |
| 端点 | 16 个,全部为 GET |
| MCP | https://instagram.fetcher.sh/mcp |
| 机器可读 | /openapi.json · /llms.txt · /skill.md |
我需要哪个端点?
| 我想要…… | 调用 |
|---|---|
| 通过 @handle 查询个人主页 | GET /api/user/handle/{handle} |
| 按名称搜索账号 | GET /api/user/search |
| 获取用户的帖子、Reels 或快拍 | GET /api/user/{id}/posts / /reels / /stories |
| 获取用户的粉丝或关注对象 | GET /api/user/{id}/followers / /followings |
| 通过分享 URL 中的 shortcode 查询帖子 | GET /api/post/code/{code} |
| 获取帖子的评论 | GET /api/post/{id}/comments |
| 查找带某个话题标签的帖子 | GET /api/hashtag/{name}/posts |
| 查找标记了某个地点的帖子 | GET /api/location/{id}/posts |
每个端点的完整参数详情:references/endpoints.md。
身份验证
有两种付费方式,获取的数据相同——完整机制请参阅 fetcher
技能:
# 1. Prepaid credits (recommended — get a key at https://fetcher.sh/topup
# or via POST /api/credits/topup, see the fetcher skill)
export FETCHER_API_KEY="bby_live_xxxxxxxxxxxx"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/user/handle/nasa"
# 2. x402 pay-per-call — omit the header; a GET with no payment returns 402
# with machine-readable payment requirements (USDC on Base, Polygon,
# Arbitrum, Monad, or Solana). @x402/fetch signs and retries automatically.
每个响应的格式均为 { "status": number, "message": string, "data": ... };HTTP 状态码与 status 一致。
端点(16 个——全部为 GET,每次调用 $0.004)
| 端点 | 返回内容 |
|---|---|
/api/user/handle/{handle} | 通过 @handle 获取完整个人主页——粉丝数、简介、数字 ID |
/api/user/search | 符合关键词查询的个人主页 |
/api/userid/{handle} | 仅获取 @handle 对应的数字用户 ID |
/api/user/{id} | 通过数字 ID 获取个人主页 |
/api/user/{id}/posts | 用户的帖子 |
/api/user/{id}/posts/tagged | 用户被标记在其中的帖子 |
/api/user/{id}/reels | 用户的 Reels |
/api/user/{id}/stories | 用户当前的快拍 |
/api/user/{id}/followers | 用户的粉丝 |
/api/user/{id}/followings | 用户关注的账号 |
/api/post/code/{code} | 通过 shortcode 获取单条帖子(来自帖子 URL) |
/api/post/{id}/comments | 帖子的评论 |
/api/hashtag/{name}/posts | 带某个话题标签的帖子 |
/api/hashtag/{name}/reels | 带某个话题标签的 Reels |
/api/location/{id}/posts | 标记了某个地点的帖子 |
/api/audio/{id}/posts | 使用指定音频/音乐曲目的帖子 |
{id} / {handle} / {name} / {code} 是路径参数。可选的
cursor / page 用于分页;出现 query(用户搜索)时,该参数为必填。
使用场景
通过 handle 查询个人主页——大多数调用方最先需要的端点:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/user/handle/nasa"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/user/handle/natgeo"
按关键词搜索个人主页,或仅查询 handle 对应的数字 ID:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
--data-urlencode "query=fitness influencer" -G \
"https://instagram.fetcher.sh/api/user/search"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/userid/nasa"
个人主页的帖子、Reels、快拍和带标签的帖子(使用上述 handle 查询返回的数字 ID):
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/user/528817151/posts"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/user/528817151/reels"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/user/528817151/stories"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/user/528817151/posts/tagged"
粉丝和关注对象:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/user/528817151/followers"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/user/528817151/followings"
通过 shortcode 查询单条帖子(URL 中 /p/ 后面的部分),以及该帖子的评论:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/post/code/C0JD3tntcmy"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/post/3245142029192513970/comments"
带某个话题标签的帖子和 Reels、来自某个地点的帖子,以及使用某个音频曲目的帖子:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/hashtag/travel/posts"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/hashtag/travel/reels"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/location/213131048/posts"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://instagram.fetcher.sh/api/audio/271328201351336/posts"
MCP
{
"mcpServers": {
"instagram": {
"url": "https://instagram.fetcher.sh/mcp",
"headers": { "Authorization": "Bearer bby_live_..." }
}
}
}
免费:search_endpoints、describe_endpoint、check_balance。付费:
fetch_data(可调用上述任意端点)、topup_credits,以及命名快捷工具
instagram_user_handle。移除 headers 块即可改用 x402 按次付费——完整流程请参阅 fetcher 技能。
错误
400— 缺少或无效的参数(消息中会注明)401— 密钥未知或已轮换402— 需要付款(x402 挑战)或topup_required(额度已用完)404— 不是计价路径- 无速率限制;上游故障不退款(先结算,再交付)
参考
- 深入了解:
references/endpoints.md(所有参数) ·references/scenarios.md(每个端点各有一个curl示例) ·references/faq.md·references/comparison.md(与官方 Instagram Graph API 和浏览器抓取工具的比较) - 任务指南:个人资料查询 · 话题标签和地点监控
- 斜杠命令:
/instagram-profile - 完整的 Agent 设置指南:https://instagram.fetcher.sh/skill.md
- OpenAPI 3.1 合约:https://instagram.fetcher.sh/openapi.json
- 精简目录:https://instagram.fetcher.sh/llms.txt
- 付款、额度和 MCP 深入指南:
fetcherskill - 网站:https://instagram.fetcher.sh