feat: migrate Twitter backend from bird CLI to xreach CLI
bird CLI (@steipete/bird) is deprecated and no longer maintained. xreach CLI (xreach-cli on npm) is our maintained fork with: - Fixed SearchTimeline (POST + updated query ID) - Built-in proxy rotation support - Additional features (DMs, notifications, lists) Changes across 11 files: - channels/twitter.py: detect xreach instead of bird/birdx - cli.py: install/doctor/uninstall all reference xreach-cli - SKILL.md: updated command examples (bird read → xreach tweet) - guides/setup-twitter.md: rewritten for xreach - docs/troubleshooting.md: updated proxy guidance - README.md + README_en.md: all references updated - config.py: twitter_bird → twitter_xreach - core.py, mcp_server.py: comment updates npm package: https://www.npmjs.com/package/xreach-cli Source: https://github.com/Panniantong/xfetch
This commit is contained in:
@@ -1,67 +1,77 @@
|
||||
# Twitter 高级功能配置指南(bird CLI)
|
||||
# Twitter 高级功能配置指南(xreach CLI)
|
||||
|
||||
## 功能说明
|
||||
基础 Twitter 功能(搜索+读单条推文)无需配置,开箱即用。
|
||||
Twitter 基础阅读通过 Jina Reader 免费可用,无需配置。
|
||||
|
||||
高级功能需要 bird CLI:
|
||||
- 查看用户时间线
|
||||
- 深度搜索(更精确、更多结果)
|
||||
- 读取完整线程(thread)
|
||||
- 查看关注列表推文
|
||||
高级功能需要 xreach CLI:
|
||||
|
||||
bird 是免费开源工具(npm 包 @steipete/bird),但需要你的 Twitter 账号 cookie。
|
||||
- 搜索推文(`xreach search`)
|
||||
- 读取完整推文和对话链(`xreach tweet`、`xreach thread`)
|
||||
- 用户时间线(`xreach tweets`)
|
||||
|
||||
## Agent 可自动完成的步骤
|
||||
xreach 是免费开源工具(npm 包 xreach-cli),但需要你的 Twitter 账号 cookie。
|
||||
|
||||
## 快速配置
|
||||
|
||||
1. 检查 xreach 是否安装:
|
||||
|
||||
1. 检查 bird 是否安装:
|
||||
```bash
|
||||
which bird && echo "installed" || echo "not installed"
|
||||
which xreach && echo "installed" || echo "not installed"
|
||||
```
|
||||
|
||||
2. 安装 bird:
|
||||
2. 安装 xreach:
|
||||
|
||||
```bash
|
||||
npm install -g @steipete/bird
|
||||
npm install -g xreach-cli
|
||||
```
|
||||
|
||||
3. 测试(需要先配置 cookie):
|
||||
3. 测试是否配置好:
|
||||
|
||||
```bash
|
||||
AUTH_TOKEN="xxx" CT0="yyy" bird search "test" -n 1
|
||||
AUTH_TOKEN="xxx" CT0="yyy" xreach search "test" -n 1
|
||||
```
|
||||
|
||||
4. 用 agent-reach 配置 cookie(推荐):
|
||||
## 获取 Cookie(Cookie-Editor 方式,推荐)
|
||||
|
||||
1. 安装 [Cookie-Editor](https://cookie-editor.com/) 浏览器扩展
|
||||
2. 登录 x.com
|
||||
3. 点击 Cookie-Editor 图标 → Export → 复制全部
|
||||
4. 运行配置命令:
|
||||
|
||||
```bash
|
||||
agent-reach configure twitter-cookies "auth_token=xxx; ct0=yyy"
|
||||
agent-reach configure twitter-cookies "粘贴的 cookie JSON"
|
||||
```
|
||||
|
||||
## 需要用户手动做的步骤
|
||||
这会自动提取 `auth_token` 和 `ct0`,并写入环境变量。
|
||||
|
||||
请告诉用户:
|
||||
## 手动设置 Cookie
|
||||
|
||||
> Twitter 高级功能需要你的 Twitter 账号 cookie(完全免费)。
|
||||
>
|
||||
> **最简单的方式:**
|
||||
> 1. 安装 Chrome 插件 [Cookie-Editor](https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm)
|
||||
> 2. 打开 https://x.com 并确保已登录
|
||||
> 3. 点击 Cookie-Editor 插件图标 → Export → Header String
|
||||
> 4. 把导出的内容发给我
|
||||
>
|
||||
> **手动方式:**
|
||||
> 1. 用 Chrome 打开 https://x.com 并确保你已登录
|
||||
> 2. 按 **F12** 打开开发者工具(Mac 按 Cmd+Option+I)
|
||||
> 3. 点击顶部的 **Application**(应用)标签
|
||||
> 4. 左侧找到 **Cookies** → **https://x.com**
|
||||
> 5. 在列表中找到以下两个值,双击复制:
|
||||
> - **auth_token** — 一串字母数字
|
||||
> - **ct0** — 一串字母数字
|
||||
> 6. 把这两个值发给我
|
||||
>
|
||||
> ⚠️ 这些 cookie 让我能以你的身份读取推文(只读)。我不会发推、点赞或做任何操作。
|
||||
> ⚠️ cookie 大约 1-3 个月会过期,届时需要重新导出。
|
||||
如果你已经知道 `auth_token` 和 `ct0`:
|
||||
|
||||
## Agent 收到 cookie 后的操作
|
||||
1. 安装 xreach(如果没装):`npm install -g xreach-cli`
|
||||
|
||||
1. 安装 bird(如果没装):`npm install -g @steipete/bird`
|
||||
2. 配置 cookie:`agent-reach configure twitter-cookies "粘贴的内容"`
|
||||
3. 测试:运行 `agent-reach doctor` 确认 Twitter 状态
|
||||
4. 反馈:"✅ Twitter 高级功能已开启!现在可以搜索推文、查看时间线了。"
|
||||
5. 如果失败:"❌ Cookie 无效或已过期,请重新导出。"
|
||||
2. 设置环境变量:
|
||||
|
||||
```bash
|
||||
export AUTH_TOKEN="你的auth_token"
|
||||
export CT0="你的ct0"
|
||||
```
|
||||
|
||||
3. 测试:
|
||||
|
||||
```bash
|
||||
xreach search "test" --auth-token "$AUTH_TOKEN" --ct0 "$CT0" -n 1
|
||||
```
|
||||
|
||||
## 代理配置
|
||||
|
||||
> xreach CLI 内置代理支持,通过 `--proxy` 参数传入:
|
||||
|
||||
```bash
|
||||
xreach search "test" --auth-token "$AUTH_TOKEN" --ct0 "$CT0" --proxy "http://user:pass@host:port"
|
||||
```
|
||||
|
||||
也支持代理轮换文件:
|
||||
|
||||
```bash
|
||||
xreach search "test" --auth-token "$AUTH_TOKEN" --ct0 "$CT0" --proxy-file proxies.txt
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user