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:
+39
-64
@@ -1,69 +1,44 @@
|
||||
# Troubleshooting / 常见问题
|
||||
# 常见问题排查
|
||||
|
||||
## Twitter/X: bird CLI "fetch failed"
|
||||
## Twitter/X: xreach CLI "fetch failed"
|
||||
|
||||
**症状:** `bird whoami` 或 `bird search` 返回 "fetch failed"
|
||||
**症状:** `xreach search` 或其他命令返回 "fetch failed"
|
||||
|
||||
**原因:** bird CLI 使用 Node.js 原生 `fetch()` 发请求,而 Node.js 的 fetch **不走系统代理**(不读取 `HTTP_PROXY`/`HTTPS_PROXY` 环境变量)。如果你的网络环境需要代理才能访问 x.com,bird 就连不上。
|
||||
|
||||
**解决方案(按推荐顺序):**
|
||||
|
||||
### 方案 1:使用透明代理 / TUN 模式(推荐)
|
||||
|
||||
让代理工具接管所有网络流量,这样 bird 的 fetch 也会走代理:
|
||||
|
||||
- **Clash Verge / Clash for Windows:** 开启 TUN 模式或系统代理
|
||||
- **Proxifier(Windows):** 添加规则让 Node.js 进程走代理
|
||||
- **macOS:** 在 Surge/ClashX Pro 中开启增强模式
|
||||
|
||||
### 方案 2:验证 Cookie 有效性
|
||||
|
||||
确认 Cookie 没过期:
|
||||
|
||||
1. 在浏览器里正常登录 x.com
|
||||
2. 用 [Cookie-Editor](https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm) 重新导出 Header String
|
||||
3. 重新配置:`agent-reach configure twitter-cookies "新的Cookie"`
|
||||
|
||||
### 方案 3:不用 bird,用 Exa 搜索替代
|
||||
|
||||
bird 不可用时,可以直接用 Exa 搜索 Twitter 内容:
|
||||
|
||||
```bash
|
||||
mcporter call 'exa.web_search_exa(query: "site:x.com query", numResults: 10)'
|
||||
```
|
||||
|
||||
### 方案 4:配置 Node.js 全局代理(高级)
|
||||
|
||||
安装 `global-agent` 让 Node.js 的 fetch 走代理:
|
||||
|
||||
```bash
|
||||
npm install -g global-agent
|
||||
```
|
||||
|
||||
然后在运行 bird 前设置环境变量:
|
||||
|
||||
```bash
|
||||
# Linux / macOS
|
||||
export GLOBAL_AGENT_HTTP_PROXY=http://127.0.0.1:7890
|
||||
export NODE_OPTIONS="--require global-agent/bootstrap"
|
||||
bird search "test"
|
||||
|
||||
# Windows (PowerShell)
|
||||
$env:GLOBAL_AGENT_HTTP_PROXY = "http://127.0.0.1:7890"
|
||||
$env:NODE_OPTIONS = "--require global-agent/bootstrap"
|
||||
bird search "test"
|
||||
```
|
||||
|
||||
> ⚠️ 注意:这个方案需要每次运行 bird 前都设置环境变量,不太方便。推荐用方案 1。
|
||||
|
||||
---
|
||||
|
||||
## Boss直聘: "访问行为异常"
|
||||
|
||||
**症状:** mcp-bosszp 登录成功,但 API 请求返回"您的访问行为异常"
|
||||
|
||||
**原因:** Boss直聘的反爬机制会检测请求指纹(不只是 IP),Python requests 库的特征与真实浏览器不同。
|
||||
**原因:** xreach CLI 使用 Node.js 的 `undici` 库发请求。如果你的网络环境需要代理才能访问 x.com,需要明确传入代理参数。
|
||||
|
||||
**解决方案:**
|
||||
- **本地电脑:** 正常使用,一般不会被拦
|
||||
- **服务器:** 使用 Jina Reader 读取职位页面 + Exa 搜索职位信息作为替代
|
||||
|
||||
### 方案 1:使用 --proxy 参数
|
||||
|
||||
```bash
|
||||
xreach search "test" --auth-token "$AUTH_TOKEN" --ct0 "$CT0" --proxy "http://user:pass@host:port"
|
||||
```
|
||||
|
||||
### 方案 2:使用全局代理工具
|
||||
|
||||
让代理工具接管所有网络流量,这样 xreach 的请求也会走代理:
|
||||
|
||||
```bash
|
||||
# macOS — ClashX / Surge 开启"增强模式"
|
||||
# Linux — proxychains 或 tun2socks
|
||||
proxychains xreach search "test" -n 1
|
||||
```
|
||||
|
||||
### 方案 3:不用 xreach,用 Exa 搜索替代
|
||||
|
||||
xreach 不可用时,可以直接用 Exa 搜索 Twitter 内容:
|
||||
|
||||
```bash
|
||||
mcporter call 'exa.web_search_exa(query: "site:x.com 搜索词", numResults: 5)'
|
||||
```
|
||||
|
||||
### 方案 4:设置 HTTP_PROXY 环境变量
|
||||
|
||||
```bash
|
||||
export HTTP_PROXY="http://127.0.0.1:7890"
|
||||
export HTTPS_PROXY="http://127.0.0.1:7890"
|
||||
|
||||
xreach search "test"
|
||||
```
|
||||
|
||||
> ⚠️ 注意:Node.js 原生 fetch 不一定读取这些环境变量,推荐用方案 1 的 --proxy 参数。
|
||||
|
||||
Reference in New Issue
Block a user