SuperAPI AI 工具集

bird

通用与其它

查看项目

更新于 10-16 10:55

技能介绍

bird 是一个面向 X/Twitter 的命令行工具,官方描述为基于 GraphQL 与 cookie 认证的快速 CLI。

用途:在终端中读取、搜索、发布内容并与 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 <path>。

主要命令: 账号与认证:bird whoami(显示已登录账号)、bird check(显示凭据来源)、bird query-ids --fresh(刷新 GraphQL query ID 缓存)。

读取推文:bird read <url-or-id>(读取单条推文)、bird <url-or-id>(read 的简写)、bird thread <url-or-id>(完整会话串)、bird replies <url-or-id>(列出某条推文的回复)。

时间线:bird home(首页 For You 时间线)、bird home --following(Following 时间线)、bird user-tweets @handle -n 20(用户资料时间线)、bird mentions(提及你的推文)、bird mentions --user @handle(其他用户的提及)。

搜索:bird search "query" -n 10、bird search "from:steipete" --all --max-pages 3。

新闻与趋势:bird news -n 10(来自 Explore 标签页的 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-or-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-or-id> "nice thread!"、bird tweet "check this out" --media image.png --alt "description"。官方提示:发布更容易受到速率限制;若被阻止,请改用浏览器工具。

媒体上传:bird tweet "hi" --media img.png --alt "description"、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、chromeProfileDir、timeoutMs、quoteDepth。环境变量:BIRD_TIMEOUT_MS、BIRD_COOKIE_TIMEOUT_MS、BIRD_QUOTE_DEPTH。

故障排查:Query ID 过期(404 错误)时运行 bird query-ids --fresh;cookie 提取失败时,检查浏览器是否已登录 X、尝试不同的 --cookie-source;对于 Arc/Brave,使用 --chrome-profile-dir。

适用场景:希望在终端或脚本中读取、搜索、发布和互动 X/Twitter 内容的用户。

限制:认证依赖 cookie;发推更容易受到速率限制,若被阻止需改用浏览器工具;媒体上传最多 4 张图片或 1 个视频。