关于 bird
bird 是用于读取和管理 X/Twitter 内容的命令行工具指南,适合需要通过 CLI 检索帖子、线程及用户内容的人。它还涵盖书签、新闻和发帖操作,并支持 JSON 输出与 Cookie 身份验证。
主要功能
- 01读取帖子、线程和回复
- 02搜索帖子并分页获取结果
- 03查看用户帖子与提及
- 04列出和管理书签
- 05获取新闻及趋势内容
- 06支持 JSON 输出与 Cookie 认证
适用场景
- 01按关键词查找 X/Twitter 帖子
- 02读取用户时间线和提及
- 03查看并处理书签
- 04以 JSON 提取帖子或媒体信息
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ liewcf/ agent-skills --skill bird安装后在 Claude Code 中输入/bird确认已加载。
附带文件README.mdreferences/commands.md
详细介绍
Bird - X/Twitter 命令行工具
使用 bird 命令行工具与 X/Twitter 内容交互的指南。
快速入门
全局安装 bird:
npm install -g @steipete/bird
# or
pnpm add -g @steipete/bird
# or
bun add -g @steipete/bird
# one-shot (no install)
bunx @steipete/bird whoami
# or
brew install steipete/tap/bird
验证身份验证:
bird whoami # Show logged-in account
bird check # Check available credentials
常见任务
阅读推文和串文
# Read a single tweet
bird read <tweet-url-or-id>
bird <tweet-url-or-id> # shorthand
# Read a thread (tweet + replies)
bird thread <tweet-url-or-id>
# Get replies only
bird replies <tweet-url-or-id>
# Output as JSON for processing
bird read <id> --json
bird thread <id> --json --max-pages 3
搜索推文
# Basic search
bird search "query" -n 10
# Search from a specific user
bird search "from:username" -n 20
# Get all results (paginated)
bird search "query" --all --json
# Search with date filters
bird search "query since:2024-01-01" -n 50
获取用户内容
# User's tweets
bird user-tweets @username -n 20
bird user-tweets @username -n 50 --json
# User mentions
bird mentions --user @username -n 10
管理书签
# List bookmarks
bird bookmarks -n 20
bird bookmarks --all --json
# From a specific folder
bird bookmarks --folder-id <id> -n 10
# Remove a bookmark
bird unbookmark <tweet-id-or-url>
获取新闻和趋势
# AI-curated news
bird news --ai-only -n 10
# Sports/Entertainment news
bird news --sports -n 15
bird news --entertainment -n 10
# Include related tweets
bird news --with-tweets --tweets-per-item 3 -n 10
# Trending topics
bird trending -n 10
发布推文(谨慎使用)
# Send a tweet
bird tweet "hello world"
# Reply to a tweet
bird reply <tweet-id-or-url> "my reply"
处理 JSON 输出
使用 jq 从 JSON 输出中提取特定字段:
# Get tweet text only
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}'
# Extract media URLs
bird read <id> --json | jq -r '.media[]?.url'
# Save to file
bird user-tweets @user --all --json > tweets.json
身份验证
Bird 使用基于 Cookie 的身份验证(无需 API 密钥)。
使用 --auth-token / --ct0 直接传递 Cookie,或使用 --cookie-source 获取浏览器 Cookie。
浏览器 Cookie 来源:
- Safari、Chrome 或 Firefox(macOS)
- Chromium 变体(Arc/Brave 等):使用
--chrome-profile-dir - 使用
--cookie-source选择 Cookie 顺序,并使用--firefox-profile指定 Firefox 配置文件 --cookie-source可重复使用:safari|chrome|firefox|all|none
配置文件
全局:~/.config/bird/config.json5
项目:./.birdrc.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
重要说明
- 使用未公开的 X/Twitter GraphQL API,可能会在未通知的情况下失效
- 建议:仅用于阅读。发推可能会触发封锁。
- 速率限制适用:使用
--delay <ms>在请求之间添加延迟 - 分页(受支持时):
search、bookmarks、likes、following和followers需要使用--all,或搭配--max-pages使用--cursor;list-timeline会将--max-pages视为--all
故障排除
查询 ID 过期(404 错误):
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,而不是标志,以快速进行检查
参考
完整的命令文档请参阅 references/commands.md。
评论
支持 Markdown