Install
openclaw skills install @xiewxx/maxhub-instagramInstagram 公开社交数据查询与内容分析 skill,通过 MaxHub API 查询帖子/Reels/Stories/Highlights、评论、点赞列表、用户资料、粉丝/关注、搜索、标签和相关内容。适合海外社媒运营、KOL 画像、内容互动分析、竞品跟踪和趋势研究。默认 read-only,侧重公开或用户授权范围内的数据;agent 应优先使用 recipes 进行单端点或链式调用,并避免采集超出用户授权的个人信息。所有请求发送到 https://www.aconfig.cn。
openclaw skills install @xiewxx/maxhub-instagramInstagram 数据查询工具,通过 MaxHub API 接入 Instagram 平台,覆盖 V1 / V2 / V3 三大版本接口,全面支持帖子(Post)、Reels、Stories、Highlights、用户资料、粉丝/关注、Hashtag、Location、评论与回复、综合搜索等数据采集场景。专注服务于海外网红营销、跨境品牌监控、社媒数据爬取、用户增长分析与内容选题等业务,帮助用户快速锁定目标账号、提取爆款规律、量化品牌话题热度。
📋 数据传输与隐私声明(请认真阅读)
- 第三方传输:您提供的所有 ID、关键词、链接、cookie 等参数都会通过 HTTPS 发送到
https://www.aconfig.cn(MaxHub 数据服务)进行处理。- UGC 隐私:拉回的评论 / 弹幕 / 动态 / 私信 / 联系人等内容可能包含个人信息或敏感 UGC,请勿写入未授权的数据库或公开发布。
- 凭证保护:建议使用独立测试账号、定期轮换 API Key;禁止传入主力生产账号的 cookie 或 session 凭证。
- 合规责任:使用方需自行确保符合所在地区的数据保护法律(《个人信息保护法》/ GDPR / 平台 ToS 等),平台账号的合规性由使用方承担。
请前往 MaxHub 控制台 注册账号并获取 API Key。
方案 1:OpenClaw 配置
将 MAXHUB_API_KEY 添加到 ~/.openclaw/openclaw.json 中:
{ "env": { "MAXHUB_API_KEY": "ak_xxxx..." } }
方案 2:终端环境变量
export MAXHUB_API_KEY="ak_xxxx..."
本 Skill 不需要额外脚本依赖,所有调用通过 curl 完成 HTTP 请求即可,无第三方库依赖。
| 环境变量 | 说明 | 是否必填 | 获取方式 |
|---|---|---|---|
MAXHUB_API_KEY | MaxHub 数据 API Key | 是 | MaxHub 控制台 |
此小节定义 agent 在每次接到用户请求时的标准决策流程。严格按此顺序执行可大幅提升命中率与减少误调用。
| 步骤 | 何时读 | 加载文件 | 估算 token |
|---|---|---|---|
| ① 永远先读 | 接到任何请求时 | SKILL.md §0.1(不支持清单)+ §4(本节) | ~1K |
| ② 选择 recipe | 用户语义清晰时 | references/recipes/_index.md(仅索引) | ~1.5K |
| ③ 加载 recipe 详情 | 匹配到具体 recipe 时 | references/recipes/<domain>.md 的对应段落 | ~500/段 |
| ④ 加载端点详情 | 自定义链路或参数不明时 | references/<domain>.md 单文件 | ~3K |
| ⑤ 路径白名单校验 | 调用前 | grep '<endpoint_id>' references/endpoints_whitelist.yaml(禁止整体读) | ~50 行 |
| ⑥ 跨端点字段路由 | 链式调用时 | references/param-mappings.md § 字段流字典 | ~1K |
references/recipes/_index.md,扫 trigger_keywords 列references/atoms/_index.md,按 chain_role 列定位起点(starter)和终点(terminal)⭐⭐⭐ 首选 标记的端点;不到必要不用 ⭐ 条件 端点param-mappings.md § 字段流字典 决定,禁止自行猜 json_path| 端点 risk | 必做自检 | 步骤数 |
|---|---|---|
risk: low | ① 路径在 endpoints_whitelist.yaml | 1 步 |
risk: medium | ① 路径 ② method ③ 必填参数 ④ 写入确认 | 4 步 |
risk: high | 4 步 + 显式向用户确认参数与意图 | 5 步 |
risk: critical(restricted) | 6 步高风险确认流程(详见 §高风险能力清单) | 6 步 |
旧 SKILL 强制所有调用都做 4 步——现按 risk 等级简化。
low端点(占绝大多数)只校验路径即可。
| 现象 | 行动 | 重试 |
|---|---|---|
| 404 / 410 | §3.1(A) 5 步防臆造自检 → 通过才 STOP;禁止自改路径段重试 | 0 |
| 400 / 422 | §3.1(B) 6 步防参数臆造自检 → 通过才修参重试 | ≤1 |
| 401 / 402 / 403 | STOP,告知用户去 https://www.aconfig.cn 处理 | 0 |
| 429 | 读 Retry-After 退避;无该头时指数退避+jitter | ≤2 |
| 5xx | 等 3 秒重试 → 仍失败走端点级"降级/替换" | 1 |
HTTP 200 + code != 0 | 读 message_zh 报告用户;不重试(业务错误重试无用) | 0 |
https://www.aconfig.cn 三方接口| 规则 | 说明 |
|---|---|
| 🔒 只读 | 本技能仅用于数据查询和分析,不执行写入 / 账户操作 |
| 🚫 禁止臆造路径 | 仅使用 references/endpoints_whitelist.yaml 中的端点,不得自行拼接、改版本号、加路径段 |
| 📋 数据流向第三方 | 所有请求发送至 https://www.aconfig.cn,请使用独立测试账号并定期轮换 API Key |
| 🔑 凭证保护 | 不暴露 API Key、Cookie、Token 至日志或对话 |
| 🔀 版本不互通 | V1 / V2 / V3 端点参数不兼容,禁止跨版本套用参数名 |
Step 1 — 检查 API Key
[ -n "${MAXHUB_API_KEY:-}" ] && echo "ok" || echo "missing"
若返回 missing,停止并提示用户配置 MAXHUB_API_KEY。
Step 2 — 匹配意图 → 选择 reference
按用户目标从下表选择对应 reference 文件,每个文件自包含其领域的全部端点定义:
| 用户目标 | 加载文件 | 覆盖范围 |
|---|---|---|
| 查帖子 / Reels / Stories / Highlights / 音乐帖 / 翻译 | references/post.md | 帖子详情、Reels、Stories、Highlights、点赞、标记、shortcode↔media_id 转换、评论翻译(34 端点) |
| 查用户 / 粉丝 / 关注 / About / 曾用名 / 相似用户 | references/user.md | 用户资料、帖子、Reels、Followers、Following、Tagged、相似推荐(24 端点) |
| 搜索 / 探索 / 话题 / 地点 / 坐标 | references/search.md | 用户搜索、综合搜索、Hashtag、Location、坐标、城市、Explore(23 端点) |
| 查评论 / 回复 | references/comments.md | V1/V2/V3 帖子评论与子评论回复(6 端点) |
| 跨端点参数查询 / 字段流追溯 | references/param-mappings.md | 全局红线 + 端点路由 + V1/V2/V3 字段流字典 + 错误处理总览 |
| 路径白名单硬校验 | references/endpoints_whitelist.yaml | 87 端点的硬白名单 + Pre-call 4 步自检协议 |
Step 3 — 构建最小调用计划
Step 4 — 执行并验证
endpoints_whitelist.yaml 完成 4 步 Pre-call 自检(路径 → method → 必填 → 写入确认)message_zh 报告用户,不重试| 用户场景 | 链路 | 字段流 |
|---|---|---|
| 搜索用户 → 帖子详情 | v3_search_users → v3_get_post_info_by_code | username → code |
| 查帖子 + 评论 + 回复(V3) | v3_get_post_info_by_code → v3_get_post_comments → v3_get_comment_replies | code → media_id + comment_id 接力 |
| 查帖子 + 评论 + 回复(V2) | v2_fetch_post_info → v2_fetch_post_comments → v2_fetch_comment_replies | code_or_url → comment_id 接力 |
| 查用户 → 帖子 + Reels | v3_get_user_profile → v3_get_user_posts + v3_get_user_reels | user_id / username 复用 |
| 用户全面画像 | v2_fetch_user_info → v2_fetch_user_posts + v2_fetch_user_followers + v2_fetch_user_stories | user_id 复用 |
| Hashtag → 帖子流 | v2_search_hashtags → v2_fetch_hashtag_posts | keyword 接力 |
| Location → 附近 + 帖子 | v3_get_location_info → v3_get_location_nearby + v3_get_location_posts | location_id 复用 |
⚠️ V3 关键陷阱:
v3_get_comment_replies的必填参数是media_id+comment_id,不是code+comment_id。需先用v3_shortcode_to_media_id把 code 转成 media_id 再调用。
收到 404 时(A):
收到 400 / 422 时(B):
username 或 user_id 二选一)max_id 用到 V3 的 after)message_zh 排查| 维度 | V1 | V2 | V3 |
|---|---|---|---|
| 稳定性 | 较旧,部分端点已迁移 | 中等,仍主力 | 最新,推荐优先使用 |
| 字段丰富度 | 基础 | 中等 | 最丰富(含 Carousel / oEmbed / 推荐 Reels) |
| 翻页参数 | max_id / end_cursor | pagination_token | after / first / last |
| 推荐场景 | 历史脚本兼容 | 综合搜索、Stories、Highlights | 用户 / 帖子主流查询 |
| 触发条件 | 推荐操作 |
|---|---|
| 合法路径持续 404 / 410 | skillhub upgrade maxhub-instagram(国内)或 clawhub upgrade maxhub-instagram(国际) |
| 用户问"版本是多少" | 当前版本 v3.7.2,访问 https://skillhub.cn/skills/maxhub-instagram |
| 多端点连续 410 | skillhub upgrade maxhub-instagram --force |
| 401 / 402 / 403 | 不是版本问题,去 https://www.aconfig.cn 处理 |
| 场景 | 命令 |
|---|---|
| 查 API Key | [ -n "${MAXHUB_API_KEY:-}" ] && echo "ok" || echo "missing" |
| 查帖子详情(V3 by code) | curl -H "$maxhub_auth_header" "https://www.aconfig.cn/api/v1/instagram/v3/get_post_info_by_code?code=Cxxxx" |
| 查用户资料(V3) | curl -H "$maxhub_auth_header" "https://www.aconfig.cn/api/v1/instagram/v3/get_user_profile?username=xxx" |
| 查帖子评论(V3) | curl -H "$maxhub_auth_header" "https://www.aconfig.cn/api/v1/instagram/v3/get_post_comments?code=Cxxxx" |
| 综合搜索(V3) | curl -H "$maxhub_auth_header" "https://www.aconfig.cn/api/v1/instagram/v3/general_search?query=xxx" |
| 检查 SKILL 更新 | skillhub info maxhub-instagram 或 clawhub info maxhub-instagram |
用户输入:「帮我看 @username 这个 IG 用户的最近 post」
Agent 执行步骤:
references/recipes/_index.md → 找到 trigger 命中 → 选最长匹配的 recipereferences/recipes/<domain>.md 中对应段落,拿到 Inputs / Atomic Steps / Outputgrep 一下 endpoints_whitelist.yaml 确认存在$.data.bvid)按 recipe 的 extract 列绑定为变量,传给下游端点反例(agent 不要这么做):
endpoints_whitelist.yaml(大文件,浪费上下文)extract 列,自己猜 json_pathv3_search_users 搜索领域关键词 → 取 username → 链式调 v3_get_user_profile + v3_get_user_posts + v3_get_user_reels,提取 follower_count / 平均点赞 / Reels 播放v2_search_hashtags → v2_fetch_hashtag_posts 拉取热门帖;v3_get_location_posts 监控线下门店所在 Location;对热门帖 v3_get_post_comments 深挖评论情感v3_get_user_id_by_username 解析 user_id → v3_get_user_posts + v3_get_user_reels 翻页采集 → 对高互动帖 v3_get_post_info_by_code 取详情 + Carousel 媒体地址v2_fetch_user_followers + v2_fetch_user_following 采集列表 → 抽样 v2_fetch_user_info 取每个粉丝的 bio / 是否私密 / followers_countmaxhub-instagram/
├── SKILL.md # Skill 定义与使用文档(本文件)
├── README.md # 英文项目说明
├── README_CN.md # 中文项目说明
├── _meta.json # 版本元信息(version: 3.7.2)
└── references/
├── endpoints_whitelist.yaml # 87 端点路径硬白名单 + Pre-call 4 步自检协议
├── param-mappings.md # 中枢索引(全局红线 + 字段流字典 + 错误处理 + 版本差异)
├── post.md # 帖子域:详情/Reels/Stories/Highlights/点赞/标记/转换/翻译(34 端点)
├── user.md # 用户域:资料/帖子/粉丝/关注/About/曾用名/相似用户(24 端点)
├── search.md # 搜索域:用户/综合/Hashtag/Location/坐标/Explore(23 端点)
└── comments.md # 评论域:V1/V2/V3 帖子评论与子回复(6 端点)
| 组件 | 技术 | 说明 |
|---|---|---|
| 调用方式 | curl + Bearer Token | HTTP GET 请求,参数通过 query string 传递 |
| 数据接口 | MaxHub API | https://www.aconfig.cn/api/v1/instagram/*,通过 MAXHUB_API_KEY 鉴权 |
| 路径校验 | YAML 硬白名单 | endpoints_whitelist.yaml 提供 87 端点的逐字符校验 + 4 步 Pre-call 协议 |
| 错误处理 | 决策表 + 自检清单 | HTTP 状态码权威定义 + 防臆造自检(A/B 双轨)+ V1↔V2↔V3 替换矩阵 |
| 输出格式 | JSON Standard MaxHub Response | {code, message, message_zh, data, cache_url} |
| 更新通道 | SkillHub / ClawHub / GitHub | 国内 ⭐⭐⭐ SkillHub(腾讯云 CDN)/ 国际 ⭐⭐⭐ ClawHub / 降级 GitHub |
| 领域 | 端点数 | Reference 文件 |
|---|---|---|
| 帖子(Posts / Reels / Stories / Highlights) | 34 | post.md |
| 用户(Users) | 24 | user.md |
| 搜索(Search / Explore / Location / Hashtag) | 23 | search.md |
| 评论(Comments) | 6 | comments.md |
| 合计 | 87 | — |
media_id 这类细节陷阱