AI Agent 抓推特终于不用登录了!这个 OpenClaw 技能零配置搞定
343 stars,2天前刚更新,支持推特+微信+中文平台,完全免费。
AI Agent 想读推特,你会怎么做?
申请 Twitter API?每月 $100+。用爬虫?分分钟被封。手动复制粘贴?那还要 AI 干嘛。
x-tweet-fetcher 解决这个问题:一个 OpenClaw 技能,零配置抓取推文。
无需 API key,无需登录,无需 Cookie。一条命令,JSON 输出,Agent 直接用。
它能做什么
基础功能(零依赖)
# 抓取单条推文
python3 scripts/fetch_tweet.py --url "https://x.com/user/status/123456"
# 输出
{
"text": "推文内容...",
"likes": 91,
"retweets": 23,
"views": 14468,
"media": ["图片URL"],
"quoted_tweet": {...}
}
支持内容:
- 普通推文(完整文本 + 数据)
- 长推文(Twitter Blue)
- X Articles(长文章)
- 引用推文
- 数据统计(点赞/转发/浏览量)
高级功能(需要 Camofox)
# 回复评论(线程化)
python3 scripts/fetch_tweet.py --url "URL" --replies
# 用户时间线(最多 200 条)
python3 scripts/fetch_tweet.py --user elonmusk --limit 50
# X Lists
python3 scripts/fetch_tweet.py --list "https://x.com/i/lists/123456"
# 监控 @mentions(Cron 友好)
python3 scripts/fetch_tweet.py --monitor @username
退出码设计:
-
0= 无新内容 -
1= 有新内容 -
2= 错误
完美适配 Cron 自动化。
不只是推特
微信公众号搜索
python3 scripts/sogou_wechat.py --keyword "AI Agent" --limit 10 --json
输出:标题、URL、作者、日期。无需 API key,直接搜狗搜索。
推文发现
python3 scripts/x_discover.py --keywords "AI Agent,LLM tools" --limit 5 --json
DuckDuckGo + Camofox Google 备用。
中文平台
python3 scripts/fetch_china.py --url "微博/B站/CSDN/微信链接"
自动识别平台,统一 JSON 输出。
Python 模块导入
from scripts.fetch_tweet import fetch_tweet
# 抓取推文
tweet = fetch_tweet("https://x.com/user/status/123456")
print(tweet["text"])
# 搜索微信公众号
from scripts.sogou_wechat import sogou_wechat_search
articles = sogou_wechat_search("AI Agent", max_results=10)
# 发现推文
from scripts.x_discover import discover_tweets
result = discover_tweets(["AI Agent"], max_results=5)
Agent 直接调用,无需额外封装。
Cron 自动化
# 每 30 分钟检查 @mentions
*/30 * * * * python3 fetch_tweet.py --monitor @username || notify-send "New mentions!"
# 每天早上 9 点发现新推文
0 9 * * * python3 x_discover.py --keywords "AI Agent" --json >> ~/discoveries.jsonl
退出码 0/1/2 设计,完美适配自动化。
技术原理
基础推文
FxTwitter 公共 API:无需认证,直接 HTTP 请求,返回结构化 JSON。
高级功能
Camofox 无头浏览器:
- 基于 Camoufox(Firefox 分支)
- C++ 级别指纹伪装
- 绕过 Google、Cloudflare、反爬虫检测
Nitter 解析:解析推文内容,FxTwitter API 补充浏览量。
微信搜索
搜狗搜索:直接 HTTP,无需浏览器,返回标题、URL、作者、日期。
安装
基础功能(零依赖)
git clone https://github.com/ythx-101/x-tweet-fetcher.git
python3 scripts/fetch_tweet.py --url "URL"
完成。
高级功能(需要 Camofox)
# 方式 1:OpenClaw 插件
openclaw plugins install @askjo/camofox-browser
# 方式 2:独立安装
git clone https://github.com/jo-inc/camofox-browser
cd camofox-browser && npm install && npm start # 端口 9377
为什么选它
| 工具 | 需要登录 | 需要 API Key | 支持平台 | 价格 |
|---|---|---|---|---|
| Twitter API | ✅ | ✅ | 仅推特 | $100+/月 |
| xfetch | ✅ (Cookie) | ❌ | 仅推特 | 免费 |
| x-tweet-fetcher | ❌ | ❌ | 推特+微信+中文 | 免费 |
核心优势:
- 零配置(无需 API key、登录、Cookie)
- Agent 友好(JSON 输出,Python 模块)
- Cron 友好(退出码设计)
- 多平台(推特+微信+微博+B站+CSDN)
- 反爬虫(Camofox 指纹伪装)
使用场景
1. AI Agent 数据收集
from scripts.fetch_tweet import fetch_tweet
# Agent 自动抓取推文
tweet = fetch_tweet(url)
agent.process(tweet["text"])
无需人工干预。
2. 内容监控
# Cron 定时监控
*/30 * * * * python3 fetch_tweet.py --monitor @competitor
有新提及立即通知。
3. 竞品分析
# 抓取竞争对手时间线
python3 scripts/fetch_tweet.py --user competitor --limit 100
分析内容策略。
4. 内容创作
# 发现热点话题
python3 scripts/x_discover.py --keywords "AI,LLM" --limit 20
收集素材。
5. 学术研究
# 批量抓取推文数据
tweets = [fetch_tweet(url) for url in urls]
analyze(tweets)
用于研究分析。
最新更新
v1.6.2(2026-03-04,2天前):
- 从 Nitter 提取 tweet_id
- 通过 FxTwitter API 补充浏览量
v1.6.1(2026-03-04,3天前):
- Lists 解析修复
- 新增
retweeted_by和quoted_tweet字段
v1.6.0(2026-03-04):
- X Lists 抓取
活跃维护,持续更新。
开源
- GitHub:https://github.com/ythx-101/x-tweet-fetcher
- Stars:343
- Forks:27
- 许可证:MIT
总结
AI Agent 抓推特,不用再申请 API($100+/月)、手动登录(Cookie 过期)、写爬虫(被封号)。
用 x-tweet-fetcher:零配置、零成本、零维护。
git clone https://github.com/ythx-101/x-tweet-fetcher.git
python3 scripts/fetch_tweet.py --url "URL"
推特+微信+中文平台,一个工具全搞定。
Top comments (0)