Twitter/X 数据查询与海外舆情研究工具,通过 MaxHub API 接入 Twitter / X(twitter.com / x.com)平台,覆盖推文详情、评论(最新/热门)、转推用户列表、搜索时间线、趋势话题、用户资料、用户推文 / 回复 / 媒体、关注 / 粉丝、用户精选推文等全部能力。专注服务于海外舆情监控、Twitter KOL 影响力分析、推文爆款研究、趋势话题追踪等场景,帮助用户快速采集 X 平台全域数据,构建跨语种海外社媒洞察。
请前往 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 控制台 |
| 规则 | 说明 |
|---|---|
| ------ | ------ |
| 🔒 只读 | 本技能仅用于数据查询和分析,不执行写入 / 账户 / 发推 / 关注操作 |
| 🚫 禁止臆造路径 | 仅使用 references/endpoints_whitelist.yaml 中的端点,不得自行拼接、改版本号、加路径段 |
| 🆔 入参互转规则 | screen_name(用户名)与 rest_id(数字 ID)按端点要求严格区分,部分端点支持 oneOf,部分仅接受其一 |
| 📋 数据流向第三方 | 所有请求发送至 https://www.aconfig.cn,请使用独立测试账号并定期轮换 API Key |
| 🔑 凭证保护 | 不暴露 API Key、Cookie、Token 至日志或对话 |
Step 1 — 检查 API Key
[ -n "${MAXHUB_API_KEY:-}" ] && echo "ok" || echo "missing"
若返回 missing,停止并提示用户配置 MAXHUB_API_KEY。
Step 2 — 匹配意图 → 选择 reference
按用户目标从下表选择对应 reference 文件,每个文件自包含其领域的全部端点定义:
| 用户目标 | 加载文件 | 覆盖范围 |
|---|---|---|
| --------- | --------- | --------- |
| 查推文详情 / 评论 / 搜索 / 趋势 / 转推 | references/content.md | 推文详情、热门/最新评论、转推用户、搜索时间线、趋势(6 端点) |
| 查用户 / 推文 / 关注 / 粉丝 / 媒体 / 精选 | references/user.md | 用户资料、推文、回复、媒体、关注、粉丝、精选推文(7 端点) |
| 跨端点参数查询 / 字段流追溯 | references/param-mappings.md | 全局红线 + 端点路由 + 字段流字典 + 错误处理总览 |
| 路径白名单硬校验 | references/endpoints_whitelist.yaml | 13 个端点的硬白名单 + Pre-call 4 步自检协议 |
Step 3 — 构建最小调用计划
Step 4 — 执行并验证
endpoints_whitelist.yaml 完成 4 步 Pre-call 自检(路径 → method → 必填 → screen_name/rest_id 来源)screen_name 是否带 @、rest_id 是否为纯数字message_zh 报告用户,不重试| 用户场景 | 链路 | 字段流 |
|---|---|---|
| --------- | ------ | ------- |
| 查推文 + 评论 | fetch_tweet_detail → fetch_post_comments / fetch_latest_post_comments | tweet_id 复用 |
| 查用户 → 推文 | fetch_user_profile → fetch_user_post_tweet | screen_name / rest_id 复用 |
| screen_name → rest_id | fetch_user_profile(screen_name 入参) → 取 rest_id → 后续端点 | screen_name → rest_id |
| 查搜索 → 推文详情 | fetch_search_timeline → 取 tweet_id → fetch_tweet_detail | keyword → tweet_id |
| 查转推用户 → 用户画像 | fetch_retweet_user_list → 取 screen_name → fetch_user_profile | tweet_id → screen_name |
| 查用户全面分析 | fetch_user_profile + fetch_user_post_tweet + fetch_user_media + fetch_user_followers + fetch_user_followings | screen_name 复用 |
| 趋势 → 搜索 → 详情 | fetch_trending → 取趋势词 → fetch_search_timeline → fetch_tweet_detail | trend → keyword → tweet_id |
| 用户精选推文 | fetch_user_profile → 取 rest_id(作为 userId) → fetch_user_highlights_tweets | rest_id → userId |
收到 404 时(A):
userId 仅用于 fetch_user_highlights_tweets,其它端点用 screen_name / rest_id)→ 有清单外参数 STOP收到 400 / 422 时(B):
screen_name 不带 @,rest_id 必须纯数字)fetch_user_profile 接受 screen_name 或 rest_id)cursor 翻页参数是否上接前次响应的 cursor,禁止编造message_zh 排查next_cursornext_cursor 作为本轮 cursor 入参| 触发条件 | 推荐操作 |
|---|---|
| --------- | --------- |
| 合法路径持续 404 / 410 | skillhub upgrade maxhub-twitter(国内)或 clawhub upgrade maxhub-twitter(国际) |
| 用户问"版本是多少" | 当前版本 v3.7.2,访问 https://skillhub.cn/skills/maxhub-twitter |
| 多端点连续 410 | skillhub upgrade maxhub-twitter --force |
| 401 / 402 / 403 | 不是版本问题,去 https://www.aconfig.cn 处理 |
| 场景 | 命令 | ||
|---|---|---|---|
| --- | --- | ||
| 查 API Key | `[ -n "${MAXHUB_API_KEY:-}" ] && echo "ok" \ | \ | echo "missing"` |
| 查推文详情 | curl -H "$maxhub_auth_header" "https://www.aconfig.cn/api/v1/twitter/web/fetch_tweet_detail?tweet_id=xxx" | ||
| 查推文热门评论 | curl -H "$maxhub_auth_header" "https://www.aconfig.cn/api/v1/twitter/web/fetch_post_comments?tweet_id=xxx" | ||
| 查用户资料 | curl -H "$maxhub_auth_header" "https://www.aconfig.cn/api/v1/twitter/web/fetch_user_profile?screen_name=elonmusk" | ||
| 查用户推文 | curl -H "$maxhub_auth_header" "https://www.aconfig.cn/api/v1/twitter/web/fetch_user_post_tweet?screen_name=elonmusk" | ||
| 搜索时间线 | curl -H "$maxhub_auth_header" "https://www.aconfig.cn/api/v1/twitter/web/fetch_search_timeline?keyword=AI" | ||
| 趋势话题(美国) | curl -H "$maxhub_auth_header" "https://www.aconfig.cn/api/v1/twitter/web/fetch_trending?country=US" | ||
| 检查 SKILL 更新 | skillhub info maxhub-twitter 或 clawhub info maxhub-twitter |
fetch_trending(按 country 切换)+ fetch_search_timeline(search_type=Latest)双端点联动 → 命中关键词后链式调 fetch_tweet_detail + fetch_post_comments 还原舆情上下文 → 取 screen_name → fetch_user_profile 识别影响力账号fetch_user_profile 拉资料 → fetch_user_post_tweet 拉近期推文 → fetch_user_followers 抽样粉丝 → fetch_user_media 拉媒体推文判断内容形态fetch_search_timeline(search_type=Top) → 取爆款 tweet_id → fetch_tweet_detail 取全文 → fetch_retweet_user_list 看转推扩散链 → 输出爆款样本集fetch_trending → 命中目标趋势词 → fetch_search_timeline 全量拉推文 → 取 screen_name 集合 → 抽样 fetch_user_profile 构建参与者画像maxhub-twitter/
├── SKILL.md # Skill 定义与使用文档(本文件)
├── README.md # 英文项目说明
├── README_CN.md # 中文项目说明
├── _meta.json # 版本元信息(version: 3.7.2)
└── references/
├── endpoints_whitelist.yaml # 13 端点路径硬白名单 + Pre-call 4 步自检协议
├── param-mappings.md # 中枢索引(全局红线 + 字段流字典 + 错误处理)
├── content.md # 推文域:详情/评论/搜索/趋势/转推(6 端点)
└── user.md # 用户域:资料/推文/回复/媒体/关注/粉丝/精选(7 端点)
| 组件 | 技术 | 说明 |
|---|---|---|
| ------ | ------ | ------ |
| 调用方式 | curl + Bearer Token | HTTP GET 请求,参数通过 query string 传递 |
| 数据接口 | MaxHub API | https://www.aconfig.cn/api/v1/twitter/web/*,通过 MAXHUB_API_KEY 鉴权 |
| 路径校验 | YAML 硬白名单 | endpoints_whitelist.yaml 提供 13 端点的逐字符校验 + 4 步 Pre-call 协议 |
| 错误处理 | 决策表 + 自检清单 | HTTP 状态码权威定义 + 防臆造自检(A/B 双轨)+ 重试策略矩阵 |
| 翻页机制 | Cursor 不透明令牌 | 平台签发,禁止编造,按响应 next_cursor 接力 |
| 输出格式 | JSON Standard MaxHub Response | {code, message, message_zh, data, cache_url} |
| 更新通道 | SkillHub / ClawHub / GitHub | 国内 ⭐⭐⭐ SkillHub(腾讯云 CDN)/ 国际 ⭐⭐⭐ ClawHub / 降级 GitHub |
| 领域 | 端点数 | Reference 文件 |
|---|---|---|
| ------ | -------- | --------------- |
| 推文内容(Content) | 6 | content.md |
| 用户(Users) | 7 | user.md |
| 合计 | 13 | — |
共 9 个版本