bird
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBird - X/Twitter CLI
Bird - X/Twitter 命令行工具
Guide for using the CLI tool to interact with X/Twitter content.
bird使用命令行工具与X/Twitter内容交互的指南。
birdQuick Start
快速开始
Install bird globally:
bash
npm install -g @steipete/bird全局安装Bird:
bash
npm install -g @steipete/birdor
or
pnpm add -g @steipete/bird
pnpm add -g @steipete/bird
or
or
bun add -g @steipete/bird
bun add -g @steipete/bird
one-shot (no install)
一次性使用(无需安装)
bunx @steipete/bird whoami
bunx @steipete/bird whoami
or
or
brew install steipete/tap/bird
Verify authentication:
```bash
bird whoami # Show logged-in account
bird check # Check available credentialsbrew install steipete/tap/bird
验证身份:
```bash
bird whoami # 显示当前登录账户
bird check # 检查可用凭证Common Tasks
常见操作
Read Tweets and Threads
查看推文与推文线程
bash
undefinedbash
undefinedRead a single tweet
查看单条推文
bird read <tweet-url-or-id>
bird <tweet-url-or-id> # shorthand
bird read <tweet-url-or-id>
bird <tweet-url-or-id> # 简写形式
Read a thread (tweet + replies)
查看推文线程(推文+回复)
bird thread <tweet-url-or-id>
bird thread <tweet-url-or-id>
Get replies only
仅查看回复内容
bird replies <tweet-url-or-id>
bird replies <tweet-url-or-id>
Output as JSON for processing
以JSON格式输出以便处理
bird read <id> --json
bird thread <id> --json --max-pages 3
undefinedbird read <id> --json
bird thread <id> --json --max-pages 3
undefinedSearch Tweets
搜索推文
bash
undefinedbash
undefinedBasic search
基础搜索
bird search "query" -n 10
bird search "query" -n 10
Search from a specific user
搜索特定用户的内容
bird search "from:username" -n 20
bird search "from:username" -n 20
Get all results (paginated)
获取所有结果(分页)
bird search "query" --all --json
bird search "query" --all --json
Search with date filters
按日期筛选搜索
bird search "query since:2024-01-01" -n 50
undefinedbird search "query since:2024-01-01" -n 50
undefinedGet User Content
获取用户内容
bash
undefinedbash
undefinedUser's tweets
用户推文
bird user-tweets @username -n 20
bird user-tweets @username -n 50 --json
bird user-tweets @username -n 20
bird user-tweets @username -n 50 --json
User mentions
用户提及内容
bird mentions --user @username -n 10
undefinedbird mentions --user @username -n 10
undefinedManage Bookmarks
管理书签
bash
undefinedbash
undefinedList bookmarks
列出书签
bird bookmarks -n 20
bird bookmarks --all --json
bird bookmarks -n 20
bird bookmarks --all --json
From a specific folder
列出特定文件夹中的书签
bird bookmarks --folder-id <id> -n 10
bird bookmarks --folder-id <id> -n 10
Remove a bookmark
移除书签
bird unbookmark <tweet-id-or-url>
undefinedbird unbookmark <tweet-id-or-url>
undefinedGet News and Trending
获取新闻与热门话题
bash
undefinedbash
undefinedAI-curated news
AI精选新闻
bird news --ai-only -n 10
bird news --ai-only -n 10
Sports/Entertainment news
体育/娱乐新闻
bird news --sports -n 15
bird news --entertainment -n 10
bird news --sports -n 15
bird news --entertainment -n 10
Include related tweets
包含相关推文
bird news --with-tweets --tweets-per-item 3 -n 10
bird news --with-tweets --tweets-per-item 3 -n 10
Trending topics
热门话题
bird trending -n 10
undefinedbird trending -n 10
undefinedPost Tweets (use with caution)
发布推文(谨慎使用)
bash
undefinedbash
undefinedSend a tweet
发送推文
bird tweet "hello world"
bird tweet "hello world"
Reply to a tweet
回复推文
bird reply <tweet-id-or-url> "my reply"
undefinedbird reply <tweet-id-or-url> "my reply"
undefinedProcess JSON Output
处理JSON输出
Use to extract specific fields from JSON output:
jqbash
undefined使用从JSON输出中提取特定字段:
jqbash
undefinedGet tweet text only
仅获取推文文本
bird read <id> --json | jq -r '.text'
bird read <id> --json | jq -r '.text'
Get user info
获取用户信息
bird user-tweets @user -n 5 --json | jq '.[] | {name: .user.name, handle: .user.screen_name}'
bird user-tweets @user -n 5 --json | jq '.[] | {name: .user.name, handle: .user.screen_name}'
Extract media URLs
提取媒体链接
bird read <id> --json | jq -r '.media[]?.url'
bird read <id> --json | jq -r '.media[]?.url'
Save to file
保存到文件
bird user-tweets @user --all --json > tweets.json
undefinedbird user-tweets @user --all --json > tweets.json
undefinedAuthentication
身份验证
Bird uses cookie-based authentication (no API keys required).
Use / to pass cookies directly, or for browser cookies.
--auth-token--ct0--cookie-sourceBrowser cookie sources:
- Safari, Chrome, or Firefox (macOS)
- Chromium variants (Arc/Brave/etc): use
--chrome-profile-dir - Choose the cookie order with , and specific Firefox profile with
--cookie-source--firefox-profile - is repeatable:
--cookie-sourcesafari|chrome|firefox|all|none
Bird使用基于Cookie的身份验证(无需API密钥)。
可使用 / 直接传入Cookie,或使用从浏览器获取Cookie。
--auth-token--ct0--cookie-source浏览器Cookie来源:
- Safari、Chrome或Firefox(macOS系统)
- Chromium衍生浏览器(Arc/Brave等):使用参数
--chrome-profile-dir - 使用选择Cookie来源顺序,使用
--cookie-source指定特定Firefox配置文件--firefox-profile - 参数可重复使用:可选值为
--cookie-sourcesafari|chrome|firefox|all|none
Config File
配置文件
Global:
Project:
~/.config/bird/config.json5Project:
./.birdrc.json5Example:
json5
{
cookieSource: ["chrome"],
chromeProfileDir: "/path/to/Arc/Profile",
chromeProfile: "Default",
firefoxProfile: "default-release",
cookieTimeoutMs: 10000,
timeoutMs: 20000,
quoteDepth: 1
}Environment variables:
BIRD_TIMEOUT_MSBIRD_COOKIE_TIMEOUT_MSBIRD_QUOTE_DEPTHBIRD_QUERY_IDS_CACHE
全局配置:
项目配置:
~/.config/bird/config.json5项目配置:
./.birdrc.json5示例:
json5
{
cookieSource: ["chrome"],
chromeProfileDir: "/path/to/Arc/Profile",
chromeProfile: "Default",
firefoxProfile: "default-release",
cookieTimeoutMs: 10000,
timeoutMs: 20000,
quoteDepth: 1
}环境变量:
BIRD_TIMEOUT_MSBIRD_COOKIE_TIMEOUT_MSBIRD_QUOTE_DEPTHBIRD_QUERY_IDS_CACHE
Important Notes
重要说明
- Uses undocumented X/Twitter GraphQL API - may break without notice
- Recommendation: Use for reading only. Tweeting may trigger blocks.
- Rate limits apply - use to add delays between requests
--delay <ms> - Pagination (when supported): ,
search,bookmarks,likes, andfollowingrequirefollowersor--allwith--cursor;--max-pagestreatslist-timelineas--max-pages--all
- 使用X/Twitter未公开的GraphQL API - 可能会无预警失效
- 建议:仅用于查看内容。发布推文可能导致账号被限制
- 存在调用频率限制 - 使用参数在请求间添加延迟
--delay <ms> - 分页功能(支持的场景):、
search、bookmarks、likes和following需要使用followers或--all配合--cursor参数;--max-pages将list-timeline视为--max-pages--all
Troubleshooting
故障排除
Query IDs stale (404 errors):
bash
bird query-ids --freshQuery IDs cache:
- Default:
~/.config/bird/query-ids-cache.json - Override:
BIRD_QUERY_IDS_CACHE=/path/to/file.json
Cookie extraction fails:
- Confirm you're logged into X/Twitter in the browser
- Try a different order
--cookie-source - For Arc/Brave, pass
--chrome-profile-dir
Auth fails with flags/env:
- Ensure and
--auth-tokenare from the same session--ct0 - Try browser cookies instead of flags for a quick sanity check
查询ID过期(出现404错误):
bash
bird query-ids --fresh查询ID缓存:
- 默认路径:
~/.config/bird/query-ids-cache.json - 自定义路径:
BIRD_QUERY_IDS_CACHE=/path/to/file.json
Cookie提取失败:
- 确认已在浏览器中登录X/Twitter
- 尝试更换的顺序
--cookie-source - 对于Arc/Brave浏览器,需传入参数
--chrome-profile-dir
使用参数/环境变量身份验证失败:
- 确保和
--auth-token来自同一会话--ct0 - 尝试使用浏览器Cookie进行快速验证
Reference
参考文档
See references/commands.md for complete command documentation.
完整命令文档请查看references/commands.md。