Instagram 资料爬虫 API
最后更新: · REST · JSON
发送 GET https://api.scrapier.io/api/v2/instagram-profile/?usernames=mrbeast,并在 X-API-Key 请求头中带上你的密钥。你会以 JSON 获得该资料。每个资料 10 积分;失败的调用免费。
- 每个资料 10 积分
- 失败的调用免费
- 没有速率限制
调用 Instagram 资料爬虫 API
在你自己的应用、脚本或代理中使用 Instagram 资料爬虫 API。你需要一个 Scrapier 账号和仪表盘中的 API 密钥。请选择一种语言。
import requests# Replace YOUR_API_KEY with the key from your Scrapier dashboardAPI_KEY = "YOUR_API_KEY"params = { "usernames": "mrbeast", "include_about": "false",}r = requests.get( "https://api.scrapier.io/api/v2/instagram-profile/", headers={"X-API-Key": API_KEY}, params=params, timeout=210,)r.raise_for_status()# The result sits under data.profileresult = r.json()["data"]["profile"]print(result)
// Replace YOUR_API_KEY with the key from your Scrapier dashboardconst API_KEY = "YOUR_API_KEY";const params = new URLSearchParams({ usernames: "mrbeast", include_about: "false",});const res = await fetch(`https://api.scrapier.io/api/v2/instagram-profile/?${params}`, { headers: { "X-API-Key": API_KEY }, signal: AbortSignal.timeout(210_000),});if (!res.ok) throw new Error(`HTTP ${res.status}`);const { data } = await res.json();console.log(data.profile);
# One GET request. The key goes in a header, never in the URL.GET /api/v2/instagram-profile/?usernames=mrbeast&include_about=false HTTP/1.1Host: api.scrapier.ioX-API-Key: YOUR_API_KEYAccept: application/json
# Scrapier publishes an OpenAPI spec that covers every endpoint. No API key needed.curl -O https://api.scrapier.io/api/v2/openapi.json# Import openapi.json into Postman, Insomnia, Bruno or a code generator,# then add your key as the X-API-Key header.
# 1. Add the Scrapier MCP server to Claude Codeclaude mcp add -t http scrapier https://mcp.scrapier.io/mcp --header "X-API-Key: YOUR_API_KEY"# 2. Ask your agent. It finds the endpoint with search_endpoints# and calls it with run_scrape:"Get the Instagram profile for @mrbeast"run_scrape("instagram-profile", {usernames: "mrbeast"})
Python 版 Instagram 资料爬虫 API
只需普通的 requests,无需 SDK。每个响应都是类型化 JSON。
安装
JavaScript 版 Instagram 资料爬虫 API
可在 Node 18+、Deno、Bun 和边缘运行时中使用内置的 fetch。
检查你的环境
HTTP 版 Instagram 资料爬虫 API
一次 GET 请求。认证只需一个 X-API-Key 请求头。
检查你的环境
Instagram 资料爬虫 API 的 OpenAPI 定义
下载一次规范,然后导入到你已在使用的工具中。获取它无需密钥。
下载规范
MCP 版 Instagram 资料爬虫 API
同一个端点也是 Claude Code、Cursor 和 Windsurf 的工具调用。相同的 usernames,每个资料同样 10 积分。
安装
其他调用方式
Instagram 资料爬虫 API 交互式试玩
编辑请求,观察代码更新,然后运行。没有密钥时它显示目录示例,不计费。使用你的密钥时,它会从浏览器发出真实调用;密钥只会发送到 api.scrapier.io,从不存储。
GET /api/v2/instagram-profile/?usernames=mrbeast点击运行请求发送。没有密钥时你得到的是目录示例。
失败的调用不计费。
无论输入什么,示例都相同:它展示的是响应结构,而不是你输入的账户。
示例响应,目录示例,2026 年11月 9 日
{
"success": true,
"data": {
"usernames": "mrbeast",
"profile": {
"inputUrl": "https://www.instagram.com/mrbeast/",
"url": "https://www.instagram.com/mrbeast",
"id": "2278169415",
"username": "mrbeast",
"fullName": "MrBeast",
"biography": "Video Philanthropist 💰",
"followersCount": 456000000,
"followsCount": 500,
"postsCount": 350,
"verified": true,
"private": false,
"highlightReelCount": 5,
"profilePicUrl": "https://instagram.fbhk1-3.fna.fbcdn.net/v/t51.2885-19/mrbeast_profile.jpg",
"relatedProfiles": [],
"latestIgtvVideos": [],
"latestPosts": [],
"scraped_at": "2026-03-09T15:19:49.021Z"
},
"next_cursor": null
}
}你可以提取的数据
Instagram 资料爬虫可提取任何公开 Instagram 资料:用户名、全名、简介、粉丝数、关注数和帖子数、认证和私密标记、精选数量和头像。下面每个字段都来自目录示例响应,为结构化 JSON。
身份字段
响应中有 7 个字段。
- id
- username
- fullName
- biography
- profilePicUrl
- url
- inputUrl
状态和受众计数
响应中有 6 个字段。
- verified
- private
- followersCount
- followsCount
- postsCount
- highlightReelCount
内容和相关数组
响应中有 3 个字段。
- latestPosts
- latestIgtvVideos
- relatedProfiles
响应结构
响应中有 4 个字段。
- success
- data.usernames
- data.next_cursor
- scraped_at
响应结构参考
示例响应中的每个字段。字段名每次调用都保持不变。
| 字段 | 类型 | 示例 | 说明 |
|---|---|---|---|
profile.id | string | "2278169415" | Instagram 的数字账号 ID,字符串形式 |
profile.username | string | "mrbeast" | 不带 @ 的用户名 |
profile.fullName | string | "MrBeast" | 资料上的显示名称 |
profile.biography | string | "Video Philanthropist 💰" | 资料上显示的简介文本 |
profile.profilePicUrl | string | "https://instagram.fbhk1-3.fna.fbcdn.net/v/t…" | Instagram CDN 上的头像 URL |
profile.url | string | "https://www.instagram.com/mrbeast" | 规范的资料 URL |
profile.inputUrl | string | "https://www.instagram.com/mrbeast/" | 由你的输入构建的资料 URL |
profile.verified | boolean | true | 认证标识 |
profile.private | boolean | false | 账号为私密时为 true |
profile.followersCount | integer | 456000000 | 粉丝数,按 Instagram 报告的数值 |
profile.followsCount | integer | 500 | 该资料关注的账号 |
profile.postsCount | integer | 350 | 资料上的帖子 |
profile.highlightReelCount | integer | 5 | 资料上的快拍精选 |
profile.latestPosts | array | [] | 近期帖子;示例中为空。获取帖子请用资料帖子或完整资料 |
profile.latestIgtvVideos | array | [] | 近期 IGTV 视频;示例中为空 |
profile.relatedProfiles | array | [] | 相关账号;示例中为空。相关资料端点会返回它们 |
success | boolean | true | 每个 200 响应都为 true |
data.usernames | string | "mrbeast" | 你的输入,原样返回 |
data.next_cursor | null | null | 此处为 null:资料是单次查询 |
profile.scraped_at | string | "2026-03-09T15:19:49.021Z" | Scrapier 获取该资料的时间(ISO 8601,UTC) |
请求参数参考
| 名称 | 类型 | 必填 | 默认值 | 说明 | 示例 |
|---|---|---|---|---|---|
usernames | string | 是 | — | Instagram 用户名、@handle 或资料 URL。每次调用一个。别名:username、url、urls | mrbeast |
include_about | boolean | 否 | false | 添加 about 块(加入日期、国家)。通常为 null | true |
cursor | string | 否 | — | 翻下一页时传回 data.next_cursor;单个资料为 null | — |
use_proxy | boolean | 否 | true | 通过 Scrapier 的住宅代理池路由。保持默认 | true |
raw_data | boolean | 否 | false | 在 raw_responses 下返回 Instagram 的原始上游数据,而不是格式化后的资料 | true |
每次调用一个用户名:要查询十个资料,就调用十次。布尔值是字符串 true 或 false。
Instagram 资料爬虫 API 的分页
Instagram 资料爬虫 API 分页返回结果。翻下一页时把 data.next_cursor 作为 cursor 传回;为 null 时表示没有更多。每次成功调用,无论首页还是后续页,都是 10 积分。
无需 Instagram 登录即可访问
Instagram 资料爬虫 API 不需要 Instagram 账号、登录或会话 cookie。你在 X-API-Key 请求头中发送 Scrapier 密钥即可获得 JSON。它只读取公开数据:任何访客无需登录就能看到的内容。
速度、成本和并发
| 指标 | 数值 | 来源 |
|---|---|---|
| 成功调用的成本 | 10 积分 | Scrapier 目录 |
| 失败调用的成本 | 0 积分 | 任何非 2xx 响应 |
| 每个密钥的并行请求数 | 无限制 | 所有套餐均无速率限制 |
| 建议的客户端超时 | 210 秒 | Scrapier 文档,适用于每个端点 |
Instagram 资料爬虫 API 的延迟
Scrapier 不公布该端点的延迟或成功率数据。每次调用都在调用时读取 Instagram,所以响应时间取决于 Instagram 和结果大小。请按文档对每个端点的建议,将客户端超时设为 210 秒。
端点的限制
Instagram 资料爬虫 API 的真实限制。
- 仅限公开数据。
- 调用失败(例如资料不存在或不可用)会返回非 2xx 状态码,且消耗 0 积分。
- 数据在调用时实时读取。
- 没有速率限制,因此需要多少并行请求,就发多少。
- 较大的结果分页返回;把
data.next_cursor作为cursor传回。 - Instagram 不显示的字段不会返回。
Scrapier 与官方 Instagram API 对比
要读取你自己账号的洞察数据,官方 API 是更好的选择。Instagram Basic Display API 已于 2024 年12月 4 日关闭。
| 功能 | Scrapier 资料爬虫 | Instagram Graph API |
|---|---|---|
| 所需权限 | 一个 Scrapier API 密钥 | Meta 应用、Instagram 专业账号和访问令牌 |
| 哪些资料 | 任何公开账户 | 通过 Business Discovery 访问其他商家和创作者账号 |
| 返回的字段 | 17 个资料字段,含简介和精选数量 | Business Discovery 字段,如 followers_count、media_count 和 biography |
| 速率限制 | 无:需要多少并行请求,就发多少 | Meta 的 Graph API 按应用和用户的速率限制 |
| 应用审核 | 无 | 高级访问需要 |
| 成本 | 每个资料 10 积分,每 1,000 个资料低至 $1.20 | 获批后免费 |
错误与重试处理
| 状态 | 含义 | 是否计费 | 解决办法 |
|---|---|---|---|
| 200 | 在 data.profile 中返回的个人资料数据 | 是 | — |
| 400 | 输入有误或缺失 | 否 | 检查 usernames:每次调用一个值 |
| 401 | 缺少 X-API-Key 请求头 | 否 | 添加该请求头 |
| 402 | 积分用完(响应体含 balance) | 否 | 充值;重试无济于事 |
| 403 | API 密钥无效或已撤销 | 否 | 在控制台中检查密钥 |
| 429 | 被限流 | 否 | 等待 Retry-After 秒后重试 |
| 5xx | 上游故障或超时 | 否 | 退避重试;把客户端超时设为 210 s |
来自错误参考。任何非 2xx 响应消耗 0 积分。
Instagram 资料爬虫 API 的重试逻辑
import time, requests def get_profile(value, key, tries=5): for attempt in range(tries): r = requests.get( "https://api.scrapier.io/api/v2/instagram-profile/", headers={"X-API-Key": key}, params={"usernames": value}, timeout=210, ) if r.status_code == 429: time.sleep(int(r.headers.get("Retry-After", 2 ** attempt))) elif r.status_code >= 500: time.sleep(2 ** attempt) else: r.raise_for_status() return r.json() raise RuntimeError("gave up after retries")
价格与速率限制
| 套餐 | 月费 | 包含的个人资料数 | 每 1,000 次成本 |
|---|---|---|---|
| Hobby | $29 | 15,000 | $1.93 |
| Pro | $79 | 50,000 | $1.58 |
| Scale | $299 | 250,000 | $1.20 |
Instagram 资料爬虫 API 的计费规则
Instagram Profile Scraper API 按每个成功获取的主页收取 10 积分。失败的调用(即任何非 2xx 状态)消耗 0 积分。所有套餐都没有速率限制。付费前可以先用免费额度试用。
批量查询与 CSV
usernames 每次调用只接受一个值。对于列表,循环并行调用(没有速率限制),然后把每一行展平为一行 CSV。
import csv, requests from concurrent.futures import ThreadPoolExecutor values = ["mrbeast"] # your list def fetch(value): r = requests.get( "https://api.scrapier.io/api/v2/instagram-profile/", headers={"X-API-Key": "YOUR_API_KEY"}, params={"usernames": value}, timeout=210, ) r.raise_for_status() out = r.json()["data"]["profile"] return out if isinstance(out, list) else [out] # no rate limits: use as many workers as you need with ThreadPoolExecutor(max_workers=3) as pool: rows = [row for part in pool.map(fetch, values) for row in part] cols = ["username", "fullName", "followersCount", "followsCount", "postsCount", "verified"] with open("out.csv", "w", newline="") as f: w = csv.DictWriter(f, fieldnames=cols, extrasaction="ignore") w.writeheader() w.writerows(rows)
从 Instagram 资料爬虫 API 导出 CSV
username,fullName,followersCount,followsCount,postsCount,verified mrbeast,MrBeast,456000000,500,350,true
通过 MCP 供 AI 智能体访问
Instagram 资料爬虫 API 的 MCP
AI 代理可通过 https://mcp.scrapier.io/mcp 的 Scrapier MCP 服务器使用同一个端点。一条命令即可在 Claude Code 中注册:claude mcp add -t http scrapier https://mcp.scrapier.io/mcp --header "X-API-Key: YOUR_API_KEY"。代理用 search_endpoints 找到该端点,再用 run_scrape 和端点 ID instagram-profile 调用。它接受相同的 usernames 输入,每个资料同样 10 积分。各客户端的设置见 Instagram 资料爬虫 MCP 页面。
按角色划分的集成路径
n8n 和 Make
- 添加一个 HTTP Request 步骤
- 带上你的
X-API-Key请求头,对该端点发送 GET - 把
data.profile字段映射到你的列
循环并翻页
CSV 和展平的 JSON
把每一行展平为一行 CSV,每个字段一列,可直接用于 Sheets、Excel 或 BI 工具。
法律与合规说明
抓取公开可得的 Instagram 资料数据在许多国家通常是合法的,但答案取决于你收集什么、身在何处以及如何使用。在美国,关于公开数据抓取最常被引用的案例是 hiQ Labs v. LinkedIn。Scrapier 只返回任何访客无需登录就能看到的数据。在 GDPR 及类似法律下,收集公开数据可能是允许的,但你如何存储和使用个人数据仍须遵守当地的数据保护规定,并且 Instagram 的条款同样适用。如果你的用例涉及批量存储个人数据,请咨询法律顾问。这不是法律建议;请参阅我们的使用条款。
常见问题
有 Instagram 资料 API 吗?
有。Scrapier 的 Instagram 资料 API 用一个 GET 请求和 X-API-Key 请求头就能把任何公开资料以 JSON 返回。无需 Instagram 应用、商家账号或应用审核。
如何从 Python 调用?
对 <code>https://api.scrapier.io/api/v2/instagram-profile/</code> 使用 <code>requests.get</code>,带 <code>params={'usernames': 'mrbeast'}</code> 和 <code>headers={"X-API-Key": KEY}</code>。读取 <code>r.json()["data"]["profile"]</code>。
调用失败时会怎样?
任何非 200 响应都免费。对 429 和 5xx 请退避重试;API 已经会重试上游故障。
多少钱?
每次成功调用 10 积分 — 在 Pro 套餐下,每 1,000 个资料约 $1.58。失败的调用免费。
有 OpenAPI 规范吗?
有。获取它无需密钥,并且涵盖每个 Scrapier 端点。