bird
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesebird 🐦 — fast X CLI for tweeting, replying, and reading
bird 🐦 — 用于发推、回复、阅读推文的高速X CLI工具
birdbirdDisclaimer
免责声明
This project uses X/Twitter’s undocumented web GraphQL API (and cookie auth). X can change endpoints, query IDs,
and anti-bot behavior at any time — expect this to break without notice.
Strong recommendation: Do not use bird to tweet. You will hit blocks very quickly. Use it to read tweets.
Bots are not welcome on X/Twitter. If you absolutely have to, use browser automation instead, or pay for the Twitter API to create tweets.
本项目使用X/Twitter未公开的Web GraphQL API(以及cookie认证)。X随时可能更改接口、查询ID以及反机器人策略——请预期工具可能在无通知的情况下失效。
强烈建议:不要使用bird发推,你会很快被平台限制。仅将其用于阅读推文。X/Twitter不欢迎机器人。如果你确实需要发推,请改用浏览器自动化工具,或者付费使用Twitter API创建推文。
Install
安装
bash
npm install -g @steipete/birdbash
npm install -g @steipete/birdor
或者
pnpm add -g @steipete/bird
pnpm add -g @steipete/bird
or
或者
bun add -g @steipete/bird
bun add -g @steipete/bird
one-shot (no install)
单次运行(无需安装)
bunx @steipete/bird whoami
Homebrew (macOS, prebuilt Bun binary):
```bash
brew install steipete/tap/birdbunx @steipete/bird whoami
Homebrew(macOS,预编译的Bun二进制包):
```bash
brew install steipete/tap/birdQuickstart
快速开始
bash
undefinedbash
undefinedShow the logged-in account
展示当前登录的账号
bird whoami
bird whoami
Discover command help
查看命令帮助
bird help whoami
bird help whoami
Read a tweet (URL or ID)
阅读推文(支持URL或ID)
bird read https://x.com/user/status/1234567890123456789
bird 1234567890123456789 --json
bird read https://x.com/user/status/1234567890123456789
bird 1234567890123456789 --json
Thread + replies
主题串+回复
bird thread https://x.com/user/status/1234567890123456789
bird replies 1234567890123456789
bird replies 1234567890123456789 --max-pages 3 --json
bird thread 1234567890123456789 --max-pages 3 --json
bird thread https://x.com/user/status/1234567890123456789
bird replies 1234567890123456789
bird replies 1234567890123456789 --max-pages 3 --json
bird thread 1234567890123456789 --max-pages 3 --json
Search + mentions
搜索+提及
bird search "from:steipete" -n 5
bird mentions -n 5
bird mentions --user @steipete -n 5
bird search "from:steipete" -n 5
bird mentions -n 5
bird mentions --user @steipete -n 5
User tweets (profile timeline)
用户推文(个人主页时间线)
bird user-tweets @steipete -n 20
bird user-tweets @steipete -n 50 --json
bird user-tweets @steipete -n 20
bird user-tweets @steipete -n 50 --json
Bookmarks
书签
bird bookmarks -n 5
bird bookmarks --folder-id 123456789123456789 -n 5 # https://x.com/i/bookmarks/<folder-id>
bird bookmarks --all --json
bird bookmarks --all --max-pages 2 --json
bird bookmarks --include-parent --json
bird unbookmark 1234567890123456789
bird unbookmark https://x.com/user/status/1234567890123456789
bird bookmarks -n 5
bird bookmarks --folder-id 123456789123456789 -n 5 # https://x.com/i/bookmarks/<folder-id>
bird bookmarks --all --json
bird bookmarks --all --max-pages 2 --json
bird bookmarks --include-parent --json
bird unbookmark 1234567890123456789
bird unbookmark https://x.com/user/status/1234567890123456789
Likes
点赞
bird likes -n 5
bird likes -n 5
News and trending topics (AI-curated from Explore tabs)
新闻与热门话题(探索标签页AI精选内容)
bird news --ai-only -n 10
bird news --sports -n 5
bird news --ai-only -n 10
bird news --sports -n 5
Lists
列表
bird list-timeline 1234567890 -n 20
bird list-timeline https://x.com/i/lists/1234567890 --all --json
bird list-timeline 1234567890 --max-pages 3 --json
bird list-timeline 1234567890 -n 20
bird list-timeline https://x.com/i/lists/1234567890 --all --json
bird list-timeline 1234567890 --max-pages 3 --json
Following (who you follow)
关注列表(你关注的用户)
bird following -n 20
bird following --user 12345678 -n 10 # by user ID
bird following -n 20
bird following --user 12345678 -n 10 # 通过用户ID查询
Followers (who follows you)
粉丝列表(关注你的用户)
bird followers -n 20
bird followers --user 12345678 -n 10 # by user ID
bird followers -n 20
bird followers --user 12345678 -n 10 # 通过用户ID查询
Refresh GraphQL query IDs cache (no rebuild)
刷新GraphQL查询ID缓存(无需重新构建)
bird query-ids --fresh
undefinedbird query-ids --fresh
undefinedNews & Trending
新闻与热门话题
Fetch AI-curated news and trending topics from X's Explore page tabs:
bash
undefined从X的探索页面标签页获取AI精选的新闻和热门话题:
bash
undefinedFetch 10 news items from all tabs (default: For You, News, Sports, Entertainment)
从所有标签页获取10条新闻(默认:推荐、新闻、体育、娱乐)
bird news -n 10
bird news -n 10
Fetch only AI-curated news (filters out regular trends)
仅获取AI精选新闻(过滤普通热门内容)
bird news --ai-only -n 20
bird news --ai-only -n 20
Fetch from specific tabs
从指定标签页获取内容
bird news --news-only --ai-only -n 10
bird news --sports -n 15
bird news --entertainment --ai-only -n 5
bird news --news-only --ai-only -n 10
bird news --sports -n 15
bird news --entertainment --ai-only -n 5
Include related tweets for each news item
包含每条新闻对应的相关推文
bird news --with-tweets --tweets-per-item 3 -n 10
bird news --with-tweets --tweets-per-item 3 -n 10
Combine multiple tab filters
组合多个标签页筛选条件
bird news --sports --entertainment -n 20
bird news --sports --entertainment -n 20
JSON output
JSON格式输出
bird news --json -n 5
bird news --json-full --ai-only -n 10 # includes raw API response
Tab options (can be combined):
- `--for-you` — Fetch from For You tab only
- `--news-only` — Fetch from News tab only
- `--sports` — Fetch from Sports tab only
- `--entertainment` — Fetch from Entertainment tab only
- `--trending-only` — Fetch from Trending tab only
By default, the command fetches from For You, News, Sports, and Entertainment tabs (Trending excluded to reduce noise). Headlines are automatically deduplicated across tabs.bird news --json -n 5
bird news --json-full --ai-only -n 10 # 包含原始API响应
标签页选项(可组合使用):
- `--for-you` — 仅从推荐标签页获取内容
- `--news-only` — 仅从新闻标签页获取内容
- `--sports` — 仅从体育标签页获取内容
- `--entertainment` — 仅从娱乐标签页获取内容
- `--trending-only` — 仅从热门标签页获取内容
默认情况下,命令会从推荐、新闻、体育、娱乐标签页获取内容(为了减少噪音,排除了热门标签页)。不同标签页的头条内容会自动去重。Library
作为库使用
birdts
import { TwitterClient, resolveCredentials } from '@steipete/bird';
const { cookies } = await resolveCredentials({ cookieSource: 'safari' });
const client = new TwitterClient({ cookies });
// Search for tweets
const searchResult = await client.search('from:steipete', 50);
// Fetch news and trending topics from all tabs (default: For You, News, Sports, Entertainment)
const newsResult = await client.getNews(10, { aiOnly: true });
// Fetch from specific tabs with related tweets
const sportsNews = await client.getNews(10, {
aiOnly: true,
withTweets: true,
tabs: ['sports', 'entertainment']
});Account details (About profile):
ts
const aboutResult = await client.getUserAboutAccount('steipete');
if (aboutResult.success && aboutResult.aboutProfile) {
console.log(aboutResult.aboutProfile.accountBasedIn);
}Fields:
accountBasedInsourcecreatedCountryAccuratelocationAccuratelearnMoreUrl
birdts
import { TwitterClient, resolveCredentials } from '@steipete/bird';
const { cookies } = await resolveCredentials({ cookieSource: 'safari' });
const client = new TwitterClient({ cookies });
// 搜索推文
const searchResult = await client.search('from:steipete', 50);
// 从所有标签页获取新闻和热门话题(默认:推荐、新闻、体育、娱乐)
const newsResult = await client.getNews(10, { aiOnly: true });
// 从指定标签页获取内容并附带相关推文
const sportsNews = await client.getNews(10, {
aiOnly: true,
withTweets: true,
tabs: ['sports', 'entertainment']
});账号详情(个人简介):
ts
const aboutResult = await client.getUserAboutAccount('steipete');
if (aboutResult.success && aboutResult.aboutProfile) {
console.log(aboutResult.aboutProfile.accountBasedIn);
}字段说明:
accountBasedInsourcecreatedCountryAccuratelocationAccuratelearnMoreUrl
Commands
命令列表
- — post a new tweet.
bird tweet "<text>" - — reply to a tweet using its ID or URL.
bird reply <tweet-id-or-url> "<text>" - — show help (or help for a subcommand).
bird help [command] - — inspect or refresh cached GraphQL query IDs.
bird query-ids [--fresh] [--json] - — fetch your home timeline (For You) or Following feed.
bird home [-n count] [--following] [--json] [--json-full] - — fetch tweet content as text or JSON.
bird read <tweet-id-or-url> [--json] - — shorthand for
bird <tweet-id-or-url> [--json]when only a URL or ID is provided.read - — list replies to a tweet.
bird replies <tweet-id-or-url> [--all] [--max-pages n] [--cursor string] [--delay ms] [--json] - — show the full conversation thread.
bird thread <tweet-id-or-url> [--all] [--max-pages n] [--cursor string] [--delay ms] [--json] - — search for tweets matching a query;
bird search "<query>" [-n count] [--all] [--max-pages n] [--cursor string] [--json]requires--max-pagesor--all.--cursor - — find tweets mentioning a user (defaults to the authenticated user).
bird mentions [-n count] [--user @handle] [--json] - — get tweets from a user's profile timeline.
bird user-tweets <@handle> [-n count] [--cursor string] [--max-pages n] [--delay ms] [--json] - — list your bookmarked tweets (or a specific bookmark folder); expansion flags control thread context;
bird bookmarks [-n count] [--folder-id id] [--all] [--max-pages n] [--cursor string] [--expand-root-only] [--author-chain] [--author-only] [--full-chain-only] [--include-ancestor-branches] [--include-parent] [--thread-meta] [--sort-chronological] [--json]requires--max-pagesor--all.--cursor - — remove one or more bookmarks by tweet ID or URL.
bird unbookmark <tweet-id-or-url...> - — list your liked tweets;
bird likes [-n count] [--all] [--max-pages n] [--cursor string] [--json] [--json-full]requires--max-pagesor--all.--cursor - — fetch news and trending topics from X's Explore tabs.
bird news [-n count] [--ai-only] [--with-tweets] [--tweets-per-item n] [--for-you] [--news-only] [--sports] [--entertainment] [--trending-only] [--json] - — alias for
bird trendingcommand.news - — list your lists (owned or memberships).
bird lists [--member-of] [-n count] [--json] - — get tweets from a list timeline;
bird list-timeline <list-id-or-url> [-n count] [--all] [--max-pages n] [--cursor string] [--json]implies--max-pages.--all - — list users that you (or another user) follow;
bird following [--user <userId>] [-n count] [--cursor string] [--all] [--max-pages n] [--json]requires--max-pages.--all - — list users that follow you (or another user);
bird followers [--user <userId>] [-n count] [--cursor string] [--all] [--max-pages n] [--json]requires--max-pages.--all - — get account origin and location information for a user.
bird about <@handle> [--json] - — print which Twitter account your cookies belong to.
bird whoami - — show which credentials are available and where they were sourced from.
bird check
Bookmarks flags:
- : expand threads only when the bookmark is a root tweet.
--expand-root-only - : keep only the bookmarked author's connected self-reply chain.
--author-chain - : include all tweets from the bookmarked author within the thread.
--author-only - : keep the entire reply chain connected to the bookmarked tweet (all authors).
--full-chain-only - : include sibling branches for ancestors when using
--include-ancestor-branches.--full-chain-only - : include the direct parent tweet for non-root bookmarks.
--include-parent - : add thread metadata fields to each tweet.
--thread-meta - : sort output globally oldest to newest (default preserves bookmark order).
--sort-chronological
Global options:
- : set the
--auth-token <token>cookie manually.auth_token - : set the
--ct0 <token>cookie manually.ct0 - : choose browser cookie source (repeatable; order matters).
--cookie-source <safari|chrome|firefox> - : Chrome profile name for cookie extraction (e.g.,
--chrome-profile <name>,Default).Profile 2 - : Chrome/Chromium profile directory or cookie DB path for cookie extraction.
--chrome-profile-dir <path> - : Firefox profile for cookie extraction.
--firefox-profile <name> - : cookie extraction timeout for keychain/OS helpers (milliseconds).
--cookie-timeout <ms> - : abort requests after the given timeout (milliseconds).
--timeout <ms> - : max quoted tweet depth in JSON output (default: 1; 0 disables).
--quote-depth <n> - : stable output (no emoji, no color).
--plain - : disable emoji output.
--no-emoji - : disable ANSI colors (or set
--no-color).NO_COLOR=1 - : attach media file (repeatable, up to 4 images or 1 video).
--media <path> - : alt text for the corresponding
--alt <text>(repeatable).--media
- — 发布新推文。
bird tweet "<text>" - — 通过推文ID或URL回复推文。
bird reply <tweet-id-or-url> "<text>" - — 显示帮助(或子命令的帮助信息)。
bird help [command] - — 查看或刷新缓存的GraphQL查询ID。
bird query-ids [--fresh] [--json] - — 获取你的首页时间线(推荐)或关注流。
bird home [-n count] [--following] [--json] [--json-full] - — 以文本或JSON格式获取推文内容。
bird read <tweet-id-or-url> [--json] - — 仅提供URL或ID时,是
bird <tweet-id-or-url> [--json]命令的简写。read - — 列出推文的回复。
bird replies <tweet-id-or-url> [--all] [--max-pages n] [--cursor string] [--delay ms] [--json] - — 展示完整的对话主题串。
bird thread <tweet-id-or-url> [--all] [--max-pages n] [--cursor string] [--delay ms] [--json] - — 搜索匹配查询条件的推文;
bird search "<query>" [-n count] [--all] [--max-pages n] [--cursor string] [--json]需要搭配--max-pages或--all使用。--cursor - — 查找提及某个用户的推文(默认是当前登录用户)。
bird mentions [-n count] [--user @handle] [--json] - — 获取用户个人主页时间线的推文。
bird user-tweets <@handle> [-n count] [--cursor string] [--max-pages n] [--delay ms] [--json] - — 列出你收藏的推文(或指定书签文件夹的内容);扩展标志控制主题串上下文;
bird bookmarks [-n count] [--folder-id id] [--all] [--max-pages n] [--cursor string] [--expand-root-only] [--author-chain] [--author-only] [--full-chain-only] [--include-ancestor-branches] [--include-parent] [--thread-meta] [--sort-chronological] [--json]需要搭配--max-pages或--all使用。--cursor - — 通过推文ID或URL移除一个或多个书签。
bird unbookmark <tweet-id-or-url...> - — 列出你点赞的推文;
bird likes [-n count] [--all] [--max-pages n] [--cursor string] [--json] [--json-full]需要搭配--max-pages或--all使用。--cursor - — 从X的探索标签页获取新闻和热门话题。
bird news [-n count] [--ai-only] [--with-tweets] [--tweets-per-item n] [--for-you] [--news-only] [--sports] [--entertainment] [--trending-only] [--json] - —
bird trending命令的别名。news - — 列出你的列表(你创建的或你加入的)。
bird lists [--member-of] [-n count] [--json] - — 获取列表时间线的推文;
bird list-timeline <list-id-or-url> [-n count] [--all] [--max-pages n] [--cursor string] [--json]默认开启--max-pages。--all - — 列出你(或其他用户)关注的用户;
bird following [--user <userId>] [-n count] [--cursor string] [--all] [--max-pages n] [--json]需要搭配--max-pages使用。--all - — 列出关注你(或其他用户)的用户;
bird followers [--user <userId>] [-n count] [--cursor string] [--all] [--max-pages n] [--json]需要搭配--max-pages使用。--all - — 获取用户的账号注册地和位置信息。
bird about <@handle> [--json] - — 打印你的cookie对应的Twitter账号。
bird whoami - — 展示可用的凭证以及它们的来源。
bird check
书签定参数说明:
- : 仅当书签是根推文时才展开主题串。
--expand-root-only - : 仅保留书签作者的连续自回复串。
--author-chain - : 包含主题串中书签作者发布的所有推文。
--author-only - : 保留和书签推文关联的完整回复串(所有作者)。
--full-chain-only - : 使用
--include-ancestor-branches时包含祖先推文的兄弟分支。--full-chain-only - : 非根书签包含直接父推文。
--include-parent - : 为每条推文添加主题串元数据字段。
--thread-meta - : 全局按时间从旧到新排序(默认保留书签排序顺序)。
--sort-chronological
全局选项:
- : 手动设置
--auth-token <token>cookie。auth_token - : 手动设置
--ct0 <token>cookie。ct0 - : 选择浏览器cookie来源(可重复设置,顺序优先)。
--cookie-source <safari|chrome|firefox> - : 用于提取cookie的Chrome配置文件名称(例如
--chrome-profile <name>、Default)。Profile 2 - : 用于提取cookie的Chrome/Chromium配置文件目录或cookie数据库路径。
--chrome-profile-dir <path> - : 用于提取cookie的Firefox配置文件。
--firefox-profile <name> - : 钥匙串/系统工具提取cookie的超时时间(毫秒)。
--cookie-timeout <ms> - : 请求超时时间,超过后终止请求(毫秒)。
--timeout <ms> - : JSON输出中引用推文的最大深度(默认:1;0表示禁用)。
--quote-depth <n> - : 稳定输出(无emoji、无颜色)。
--plain - : 禁用emoji输出。
--no-emoji - : 禁用ANSI颜色(或设置
--no-color)。NO_COLOR=1 - : 附加媒体文件(可重复设置,最多4张图片或1个视频)。
--media <path> - : 对应
--alt <text>的替代文本(可重复设置)。--media
Authentication (GraphQL)
认证(GraphQL)
GraphQL mode uses your existing X/Twitter web session (no password prompt). It sends requests to internal
X endpoints and authenticates via cookies (, ).
auth_tokenct0Write operations:
- /
tweetprimarily use GraphQL (reply).CreateTweet - If GraphQL returns error (“automated request”),
226falls back to the legacybirdendpoint.statuses/update.json
bird- CLI flags: ,
--auth-token--ct0 - Environment variables: ,
AUTH_TOKEN(fallback:CT0,TWITTER_AUTH_TOKEN)TWITTER_CT0 - Browser cookies via (override via
@steipete/sweet-cookieorder)--cookie-source
Browser cookie sources:
- Safari: (fallback:
~/Library/Cookies/Cookies.binarycookies)~/Library/Containers/com.apple.Safari/Data/Library/Cookies/Cookies.binarycookies - Chrome:
~/Library/Application Support/Google/Chrome/<Profile>/Cookies - Firefox:
~/Library/Application Support/Firefox/Profiles/<profile>/cookies.sqlite- For Chromium variants (Arc/Brave/etc), pass a profile directory or cookie DB via .
--chrome-profile-dir
- For Chromium variants (Arc/Brave/etc), pass a profile directory or cookie DB via
GraphQL模式使用你现有的X/Twitter Web会话(无需输入密码)。它会向X的内部接口发送请求,并通过cookie(、)进行认证。
auth_tokenct0写操作:
- /
tweet主要使用GraphQL(reply)。CreateTweet - 如果GraphQL返回错误(“自动化请求”),
226会回退到旧版bird接口。statuses/update.json
bird- CLI参数:、
--auth-token--ct0 - 环境变量:、
AUTH_TOKEN(备选:CT0、TWITTER_AUTH_TOKEN)TWITTER_CT0 - 通过读取浏览器cookie(可通过
@steipete/sweet-cookie顺序覆盖)--cookie-source
浏览器cookie来源:
- Safari: (备选:
~/Library/Cookies/Cookies.binarycookies)~/Library/Containers/com.apple.Safari/Data/Library/Cookies/Cookies.binarycookies - Chrome:
~/Library/Application Support/Google/Chrome/<Profile>/Cookies - Firefox:
~/Library/Application Support/Firefox/Profiles/<profile>/cookies.sqlite- 对于Chromium衍生浏览器(Arc/Brave等),通过传入配置文件目录或cookie数据库路径。
--chrome-profile-dir
- 对于Chromium衍生浏览器(Arc/Brave等),通过
Config (JSON5)
配置(JSON5)
Config precedence: CLI flags > env vars > project config > global config.
- Global:
~/.config/bird/config.json5 - Project:
./.birdrc.json5
Example :
~/.config/bird/config.json5json5
{
// Cookie source order for browser extraction (string or array)
cookieSource: ["firefox", "safari"],
chromeProfileDir: "/path/to/Chromium/Profile",
firefoxProfile: "default-release",
cookieTimeoutMs: 30000,
timeoutMs: 20000,
quoteDepth: 1
}Environment shortcuts:
BIRD_TIMEOUT_MSBIRD_COOKIE_TIMEOUT_MSBIRD_QUOTE_DEPTH
配置优先级:CLI参数 > 环境变量 > 项目配置 > 全局配置。
- 全局配置:
~/.config/bird/config.json5 - 项目配置:
./.birdrc.json5
示例:
~/.config/bird/config.json5json5
{
// 浏览器提取cookie的来源顺序(字符串或数组)
cookieSource: ["firefox", "safari"],
chromeProfileDir: "/path/to/Chromium/Profile",
firefoxProfile: "default-release",
cookieTimeoutMs: 30000,
timeoutMs: 20000,
quoteDepth: 1
}环境变量快捷方式:
BIRD_TIMEOUT_MSBIRD_COOKIE_TIMEOUT_MSBIRD_QUOTE_DEPTH
Output
输出
- prints raw tweet objects for read/replies/thread/search/mentions/user-tweets/bookmarks/likes.
--json - When using with pagination (
--json,--all,--cursor, or for--max-pageswhenuser-tweets), output is-n > 20.{ tweets, nextCursor } - returns full text for Notes and Articles when present.
read - Use for stable, script-friendly output (no emoji, no color).
--plain
- 会为read/replies/thread/search/mentions/user-tweets/bookmarks/likes等命令打印原始推文对象。
--json - 当搭配分页参数(
--json、--all、--cursor,或--max-pages的user-tweets)使用时,输出格式为-n > 20。{ tweets, nextCursor } - 如果存在笔记和长文内容,会返回完整文本。
read - 使用获取稳定的、适合脚本处理的输出(无emoji、无颜色)。
--plain
JSON Schema
JSON Schema
When using , tweet objects include:
--json| Field | Type | Description |
|---|---|---|
| string | Tweet ID |
| string | Full tweet text (includes Note/Article content when present) |
| object | |
| string? | Author's user ID |
| string | Timestamp |
| number | Number of replies |
| number | Number of retweets |
| number | Number of likes |
| string | Thread conversation ID |
| string? | Parent tweet ID (present if this is a reply) |
| object? | Embedded quote tweet (same schema; depth controlled by |
When using with /, user objects include:
--jsonfollowingfollowers| Field | Type | Description |
|---|---|---|
| string | User ID |
| string | Username/handle |
| string | Display name |
| string? | User bio |
| number? | Followers count |
| number? | Following count |
| boolean? | Blue verified flag |
| string? | Profile image URL |
| string? | Account creation timestamp |
When using with /, news objects include:
--jsonnewstrending| Field | Type | Description |
|---|---|---|
| string | Unique identifier for the news item |
| string | News headline or trend title |
| string? | Category (e.g., "AI · Technology", "Trending", "News") |
| string? | Relative time (e.g., "2h ago") |
| number? | Number of posts |
| string? | Item description |
| string? | URL to the trend or news article |
| array? | Related tweets (only when |
| object? | Raw API response (only when |
使用时,推文对象包含以下字段:
--json| 字段 | 类型 | 描述 |
|---|---|---|
| string | 推文ID |
| string | 完整推文文本(存在笔记/长文时包含对应内容) |
| object | |
| string? | 作者用户ID |
| string | 时间戳 |
| number | 回复数量 |
| number | 转发数量 |
| number | 点赞数量 |
| string | 主题串会话ID |
| string? | 父推文ID(仅回复类推文存在) |
| object? | 内嵌引用推文(相同Schema;深度由 |
在/命令中使用时,用户对象包含以下字段:
followingfollowers--json| 字段 | 类型 | 描述 |
|---|---|---|
| string | 用户ID |
| string | 用户名/账号 |
| string | 展示名称 |
| string? | 用户简介 |
| number? | 粉丝数量 |
| number? | 关注数量 |
| boolean? | 蓝V认证标记 |
| string? | 头像URL |
| string? | 账号创建时间戳 |
在/命令中使用时,新闻对象包含以下字段:
newstrending--json| 字段 | 类型 | 描述 |
|---|---|---|
| string | 新闻条目的唯一标识 |
| string | 新闻头条或热门话题标题 |
| string? | 分类(例如"AI · Technology"、"Trending"、"News") |
| string? | 相对时间(例如"2h ago") |
| number? | 帖子数量 |
| string? | 条目描述 |
| string? | 热门话题或新闻文章的URL |
| array? | 相关推文(仅使用 |
| object? | 原始API响应(仅使用 |
Query IDs (GraphQL)
查询ID(GraphQL)
X rotates GraphQL “query IDs” frequently. Each GraphQL operation is addressed as:
- (e.g.
operationName,TweetDetail)CreateTweet - (rotating ID baked into X’s web client bundles)
queryId
birdsrc/lib/query-ids.jsondist/Runtime cache:
- Default path:
~/.config/bird/query-ids-cache.json - Override path:
BIRD_QUERY_IDS_CACHE=/path/to/file.json - TTL: 24h (stale cache is still used, but marked “not fresh”)
Auto-recovery:
- On GraphQL (query ID invalid),
404forces a refresh once and retries.bird - For /
TweetDetail,SearchTimelinealso rotates through a small set of known fallback IDs to reduce breakage while refreshing.bird
Refresh on demand:
bash
bird query-ids --freshExit codes:
- : success
0 - : runtime error (network/auth/etc)
1 - : invalid usage/validation (e.g. bad
2handle)--user
X会频繁轮换GraphQL“查询ID”。每个GraphQL操作的寻址方式为:
- (例如
operationName、TweetDetail)CreateTweet - (X的Web客户端包中内置的轮换ID)
queryId
birdsrc/lib/query-ids.jsondist/运行时缓存:
- 默认路径:
~/.config/bird/query-ids-cache.json - 覆盖路径:
BIRD_QUERY_IDS_CACHE=/path/to/file.json - 有效期:24小时(过期缓存仍会被使用,但会标记为“非新鲜”)
自动恢复:
- 遇到GraphQL (查询ID无效)时,
404会强制刷新一次并重试。bird - 对于/
TweetDetail,SearchTimeline还会轮换使用一小部分已知的备用ID,减少刷新期间的失效情况。bird
按需刷新:
bash
bird query-ids --fresh退出码:
- : 成功
0 - : 运行时错误(网络/认证等)
1 - : 无效使用/校验失败(例如错误的
2账号)--user
Version
版本
bird --versionpackage.json0.3.0 (3df7969b)bird --versionpackage.json0.3.0 (3df7969b)Media uploads
媒体上传
- Attach media with (repeatable) and optional
--mediaper item.--alt - Up to 4 images/GIFs, or 1 video (no mixing). Supported: jpg, jpeg, png, webp, gif, mp4, mov.
- Images/GIFs + 1 video supported (uploads via Twitter legacy upload endpoint + cookies; video may take longer to process).
Example:
bash
bird tweet "hi" --media img.png --alt "desc"- 使用附加媒体(可重复设置),每个媒体可选择性搭配
--media设置替代文本。--alt - 最多支持4张图片/GIF,或1个视频(不可混合)。支持格式:jpg、jpeg、png、webp、gif、mp4、mov。
- 支持图片/GIF+1个视频的组合(通过Twitter旧版上传接口+cookie上传;视频处理可能需要更长时间)。
示例:
bash
bird tweet "hi" --media img.png --alt "desc"