name: bird description: 基于cookie认证的X/Twitter命令行界面工具,用于阅读、搜索、发布和互动。 homepage: https://bird.fast metadata: { “otto”: { “emoji”: “🐦”, “requires”: { “bins”: [“bird”] }, “install”: [ { “id”: “brew”, “kind”: “brew”, “formula”: “steipete/tap/bird”, “bins”: [“bird”], “label”: “安装bird (brew)”, “os”: [“darwin”], }, { “id”: “npm”, “kind”: “node”, “package”: “@steipete/bird”, “bins”: [“bird”], “label”: “安装bird (npm)”, }, ], }, }
bird 🐦
使用GraphQL + cookie认证的快速X/Twitter命令行界面。
安装
# npm/pnpm/bun
npm install -g @steipete/bird
# Homebrew (macOS, 预编译二进制文件)
brew install steipete/tap/bird
# 一次性使用 (无需安装)
bunx @steipete/bird whoami
认证
bird 使用基于cookie的认证。
使用 --auth-token / --ct0 直接传递cookie,或 --cookie-source 用于浏览器cookie。
运行 bird check 查看哪个源处于活动状态。对于Arc/Brave,使用 --chrome-profile-dir <路径>。
命令
账户与认证
bird whoami # 显示登录账户
bird check # 显示凭据源
bird query-ids --fresh # 刷新GraphQL查询ID缓存
阅读推文
bird read <url或id> # 阅读单条推文
bird <url或id> # read的简写
bird thread <url或id> # 完整对话线程
bird replies <url或id> # 列出推文回复
时间线
bird home # 首页时间线 (为你推荐)
bird home --following # 关注时间线
bird user-tweets @handle -n 20 # 用户个人资料时间线
bird mentions # 提到你的推文
bird mentions --user @handle # 提到其他用户的推文
搜索
bird search "查询" -n 10
bird search "from:steipete" --all --max-pages 3
新闻与趋势
bird news -n 10 # 从探索标签AI策划
bird news --ai-only # 过滤为仅AI策划
bird news --sports # 体育标签
bird news --with-tweets # 包含相关推文
bird trending # news的别名
列表
bird lists # 你的列表
bird lists --member-of # 你作为成员的列表
bird list-timeline <id> -n 20 # 列表中的推文
书签与喜欢
bird bookmarks -n 10
bird bookmarks --folder-id <id> # 特定文件夹
bird bookmarks --include-parent # 包含父推文
bird bookmarks --author-chain # 作者自我回复链
bird bookmarks --full-chain-only # 完整回复链
bird unbookmark <url或id>
bird likes -n 10
社交图
bird following -n 20 # 你关注的用户
bird followers -n 20 # 关注你的用户
bird following --user <id> # 其他用户的关注
bird about @handle # 账户来源/位置信息
互动操作
bird follow @handle # 关注用户
bird unfollow @handle # 取消关注用户
发布
bird tweet "hello world"
bird reply <url或id> "nice thread!"
bird tweet "check this out" --media image.png --alt "描述"
⚠️ 发布风险:发布更可能被速率限制;如果被阻止,请使用浏览器工具。
媒体上传
bird tweet "hi" --media img.png --alt "描述"
bird tweet "pics" --media a.jpg --media b.jpg # 最多4张图片
bird tweet "video" --media clip.mp4 # 或1个视频
分页
支持分页的命令:replies, thread, search, bookmarks, likes, list-timeline, following, followers, user-tweets
bird bookmarks --all # 获取所有页
bird bookmarks --max-pages 3 # 限制页数
bird bookmarks --cursor <cursor> # 从光标恢复
bird replies <id> --all --delay 1000 # 页间延迟 (毫秒)
输出选项
--json # JSON输出
--json-full # 包含原始API响应的JSON
--plain # 无emoji, 无颜色 (脚本友好)
--no-emoji # 禁用emoji
--no-color # 禁用ANSI颜色 (或设置 NO_COLOR=1)
--quote-depth n # JSON中引用推文的最大深度 (默认: 1)
全局选项
--auth-token <token> # 设置auth_token cookie
--ct0 <token> # 设置ct0 cookie
--cookie-source <source> # 浏览器cookie源 (可重复)
--chrome-profile <name> # Chrome配置文件名称
--chrome-profile-dir <path> # Chrome/Chromium配置文件目录或cookie数据库路径
--firefox-profile <name> # Firefox配置文件
--timeout <ms> # 请求超时
--cookie-timeout <ms> # cookie提取超时
配置文件
~/.config/bird/config.json5 (全局) 或 ./.birdrc.json5 (项目):
{
cookieSource: ["chrome"],
chromeProfileDir: "/path/to/Arc/Profile",
timeoutMs: 20000,
quoteDepth: 1,
}
环境变量: BIRD_TIMEOUT_MS, BIRD_COOKIE_TIMEOUT_MS, BIRD_QUOTE_DEPTH
故障排除
查询ID过时 (404错误)
bird query-ids --fresh
cookie提取失败
- 检查浏览器是否登录X
- 尝试不同的
--cookie-source - 对于Arc/Brave: 使用
--chrome-profile-dir
TL;DR: 通过CLI阅读/搜索/互动。发布需谨慎或使用浏览器。🐦