mcpField
I
instagram-scraper

instagram-scraper

github.com/fetcher-sh数据与数据库23.8k 次安装8 周前更新
代码仓库

关于 instagram-scraper

instagram-scraper 是面向数据分析与社交媒体研究的 Instagram 数据 API 技能,可查询资料、内容和互动数据,并提供 HTTP 与 MCP 访问方式。

主要功能

  1. 01按用户名查询资料
  2. 02检索帖子、Reels 和 Stories
  3. 03查询关注者与关注列表
  4. 04检索标签、地点和音乐内容
  5. 05读取帖子及评论

适用场景

  1. 01跟踪账号发布内容
  2. 02监测主题标签或地点帖子
  3. 03分析帖子评论与互动
  4. 04按用户名查找 Instagram 账号

MCP 相关

提供位于 https://instagram.fetcher.sh/mcp 的 MCP 服务,支持端点检索、端点说明、余额查询及付费数据获取。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/fetcher-sh/fetcher-skills --skill instagram-scraper

安装后在 Claude Code 中输入/instagram-scraper确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
comparison.md
endpoints.md
faq.md
scenarios.md

详细介绍

Instagram Scraper API

按需获取 Instagram 数据:通过 @handle 查询个人资料、帖子、Reels、快拍、标记的帖子、粉丝和关注对象、话题标签和地点动态、音频/音乐动态,以及帖子评论——每次调用只需发送一个普通 HTTP GET 请求,按量付费。无需登录、会话 Cookie、无头浏览器,也无需通过 Graph API 商业验证。

基础 URL:https://instagram.fetcher.sh

快速参考

基础 URLhttps://instagram.fetcher.sh
身份验证Authorization: Bearer bby_live_... 或 x402(USDC)
价格每次调用 $0.004(固定)
端点16 个,全部为 GET
MCPhttps://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 中的短代码查询帖子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}通过短代码获取单条帖子(短代码来自帖子 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"

通过短代码获取单条帖子(即 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 — 不是计价路径
  • 无速率限制;上游故障不退款(先结算,再交付)

参考

评论

支持 Markdown