[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74134":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":9,"pushedAt":9,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":15,"starSnapshotCount":15,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},74134,"twitter-cli","public-clis\u002Ftwitter-cli","public-clis","A CLI for Twitter\u002FX — feed, bookmarks, and user timeline in terminal",null,"Python",2567,233,9,14,0,20,51,164,60,29.11,"Apache License 2.0",false,"main",true,[],"2026-06-12 02:03:22","# twitter-cli\n\n[![CI](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Ftwitter-cli\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg?branch=main)](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Ftwitter-cli\u002Factions\u002Fworkflows\u002Fci.yml)\n[![PyPI version](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Ftwitter-cli.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Ftwitter-cli\u002F)\n[![Python](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-%3E%3D3.10-blue.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Ftwitter-cli\u002F)\n\nA terminal-first CLI for Twitter\u002FX: read timelines, bookmarks, and user profiles without API keys.\n\n## More Tools\n\n- [xiaohongshu-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Fxiaohongshu-cli) — Xiaohongshu (小红书) CLI for notes and account workflows\n- [bilibili-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Fbilibili-cli) — Bilibili CLI for videos, users, search, and feeds\n- [discord-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Fdiscord-cli) — Discord CLI for local-first sync, search, and export\n- [tg-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Ftg-cli) — Telegram CLI for local-first sync, search, and export\n\n[English](#english) | [中文](#中文)\n\n## English\n\n### Features\n\n**Read:**\n- Timeline: fetch `for-you` and `following` feeds\n- Bookmarks: list saved tweets from your account\n- Search: find tweets by keyword with Top\u002FLatest\u002FPhotos\u002FVideos tabs\n- Tweet detail: view a tweet and its replies; use `show \u003CN>` to open tweet #N from the last list output\n- Article: fetch a Twitter Article and export it as Markdown\n- List timeline: fetch tweets from a Twitter List\n- User lookup: fetch user profile, tweets, likes, followers, and following\n- `--full-text`: disable tweet text truncation in rich table output\n- Structured output: export any data as YAML or JSON for scripting and AI agent integration\n- Optional scoring filter: rank tweets by engagement weights\n- Structured output contract: [SCHEMA.md](.\u002FSCHEMA.md)\n\n> **AI Agent Tip:** Prefer `--yaml` for structured output unless a strict JSON parser is required. Non-TTY stdout defaults to YAML automatically. Use `--max` to limit results.\n\n**Write:**\n- Post: create new tweets and replies, with optional image attachments (up to 4)\n- Quote: quote-tweet with optional images\n- Delete: remove your own tweets\n- Like \u002F Unlike: manage tweet likes\n- Retweet \u002F Unretweet: manage retweets\n- Bookmark: bookmark\u002Funbookmark (`favorite\u002Funfavorite` kept as compatibility aliases)\n- Write commands also support explicit `--json` \u002F `--yaml` output now\n\n**Auth & Anti-Detection:**\n- Cookie auth: use browser cookies or environment variables\n- Full cookie forwarding: extracts ALL browser cookies for richer browser context\n- TLS fingerprint impersonation: `curl_cffi` with dynamic Chrome version matching\n- `x-client-transaction-id` header generation\n- Request timing jitter to avoid pattern detection\n- Write operation delays (1.5–4s random) to mitigate rate limits\n- Proxy support via `TWITTER_PROXY` environment variable\n\n### Installation\n\n```bash\n# Recommended: uv tool (fast, isolated)\nuv tool install twitter-cli\n\n# Alternative: pipx\npipx install twitter-cli\n```\n\nUpgrade to the latest version:\n\n```bash\nuv tool upgrade twitter-cli\n# Or: pipx upgrade twitter-cli\n```\n\n> **Tip:** Upgrade regularly to avoid unexpected errors from outdated API handling.\n\nInstall from source:\n\n```bash\ngit clone git@github.com:jackwener\u002Ftwitter-cli.git\ncd twitter-cli\nuv sync\n```\n\n### Quick Start\n\n```bash\n# Fetch home timeline (For You)\ntwitter feed\n\n# Fetch Following timeline\ntwitter feed -t following\n\n# Enable ranking filter explicitly\ntwitter feed --filter\n```\n\n### Usage\n\n```bash\n# Feed\ntwitter feed --max 50\ntwitter feed --cursor \"\u003Cnext-cursor-from-previous-response>\"\ntwitter feed --full-text\ntwitter feed --output tweets.json\ntwitter feed --input tweets.json\ntwitter feed --json                    # Structured stdout for scripts\u002Fagents\n\n# Bookmarks\ntwitter bookmarks\ntwitter bookmarks --full-text\ntwitter bookmarks --max 30 --yaml\n\n# Search\ntwitter search \"Claude Code\"\ntwitter search \"AI agent\" -t Latest --max 50\ntwitter search \"AI agent\" --full-text\ntwitter search \"机器学习\" --yaml\ntwitter search \"python\" --from elonmusk --lang en --since 2026-01-01\ntwitter search --from bbc --exclude retweets --has links\ntwitter search \"topic\" -o results.json         # Save to file\ntwitter search \"trending\" --filter              # Apply ranking filter\n\n# Tweet detail (view tweet + replies)\ntwitter tweet 1234567890\ntwitter tweet 1234567890 --full-text\ntwitter tweet https:\u002F\u002Fx.com\u002Fuser\u002Fstatus\u002F1234567890\n\n# Open tweet by index from last list output\ntwitter show 2                         # Open tweet #2 from last feed\u002Fsearch\ntwitter show 2 --full-text             # Full text in reply table\ntwitter show 2 --json                  # Structured output\n\n# Twitter Article\ntwitter article 1234567890\ntwitter article https:\u002F\u002Fx.com\u002Fuser\u002Farticle\u002F1234567890 --json\ntwitter article 1234567890 --markdown\ntwitter article 1234567890 --output article.md\n\n# List timeline\ntwitter list 1539453138322673664\ntwitter list 1539453138322673664 --cursor \"\u003Cnext-cursor-from-previous-response>\"\ntwitter list 1539453138322673664 --full-text\n\n# User\ntwitter user elonmusk\ntwitter user-posts elonmusk --max 20\ntwitter user-posts elonmusk --full-text\ntwitter user-posts elonmusk -o tweets.json\ntwitter likes elonmusk --max 30          # ⚠️ own likes only (private since Jun 2024)\ntwitter likes elonmusk --full-text\ntwitter likes elonmusk -o likes.json\ntwitter followers elonmusk --max 50\ntwitter following elonmusk --max 50\n\n# Write operations\ntwitter post \"Hello from twitter-cli!\"\ntwitter post \"Hello!\" --image photo.jpg            # Post with image\ntwitter post \"Gallery\" -i a.png -i b.jpg -i c.webp  # Up to 4 images\ntwitter post \"reply text\" --reply-to 1234567890\ntwitter reply 1234567890 \"Nice!\" -i screenshot.png  # Reply with image\ntwitter quote 1234567890 \"Look\" -i chart.png        # Quote with image\ntwitter post \"Hello from twitter-cli!\" --json\ntwitter delete 1234567890\ntwitter like 1234567890\ntwitter like 1234567890 --yaml\ntwitter unlike 1234567890\ntwitter retweet 1234567890\ntwitter unretweet 1234567890\ntwitter bookmark 1234567890\ntwitter unbookmark 1234567890\ntwitter follow elonmusk --json\n```\n\n### Authentication\n\ntwitter-cli uses this auth priority:\n\n1. **Environment variables**: `TWITTER_AUTH_TOKEN` + `TWITTER_CT0`\n2. **Browser cookies** (recommended): auto-extract from Arc\u002FChrome\u002FEdge\u002FFirefox\u002FBrave\n\nBrowser extraction is recommended — it forwards ALL Twitter cookies (not just `auth_token` + `ct0`) and aligns request headers with your local runtime, which is closer to normal browser traffic than minimal cookie auth.\n\n**Chrome multi-profile**: All Chrome profiles are scanned automatically. To specify a profile:\n\n```bash\nTWITTER_CHROME_PROFILE=\"Profile 2\" twitter feed\n```\n\n**Browser priority:** If you have multiple browsers, set `TWITTER_BROWSER` to try a specific browser first:\n\n```bash\nTWITTER_BROWSER=chrome twitter feed    # Supported: arc, chrome, edge, firefox, brave\n```\n\nAfter loading cookies, the CLI performs lightweight verification. Commands that require account access fail fast on clear auth errors (`401\u002F403`).\n\n### Proxy Support\n\nSet `TWITTER_PROXY` to route all requests through a proxy:\n\n```bash\n# HTTP proxy\nexport TWITTER_PROXY=http:\u002F\u002F127.0.0.1:7890\n\n# SOCKS5 proxy\nexport TWITTER_PROXY=socks5:\u002F\u002F127.0.0.1:1080\n```\n\nUsing a proxy can help reduce IP-based rate limiting risks.\n\n### Configuration\n\nCreate `config.yaml` in your working directory:\n\n```yaml\nfetch:\n  count: 50\n\nfilter:\n  mode: \"topN\"          # \"topN\" | \"score\" | \"all\"\n  topN: 20\n  minScore: 50\n  lang: []\n  excludeRetweets: false\n  weights:\n    likes: 1.0\n    retweets: 3.0\n    replies: 2.0\n    bookmarks: 5.0\n    views_log: 0.5\n\nrateLimit:\n  requestDelay: 2.5     # base delay between requests (randomized ×0.7–1.5)\n  maxRetries: 3          # retry count on rate limit (429)\n  retryBaseDelay: 5.0    # base delay for exponential backoff\n  maxCount: 200          # hard cap on fetched items\n```\n\nFetch behavior:\n\n- `fetch.count` is the default item count for read commands when `--max` is omitted\n- Rich table output truncates long tweet text by default; use `--full-text` to show full body text in list views\n\nFilter behavior:\n\n- Default behavior: no ranking filter unless `--filter` is passed\n- With `--filter`: tweets are scored\u002Fsorted using `config.filter`\n\nScoring formula:\n\n```text\nscore = likes_w * likes\n      + retweets_w * retweets\n      + replies_w * replies\n      + bookmarks_w * bookmarks\n      + views_log_w * log10(max(views, 1))\n```\n\nMode behavior:\n\n- `mode: \"topN\"` keeps the highest `topN` tweets by score\n- `mode: \"score\"` keeps tweets where `score >= minScore`\n- `mode: \"all\"` returns all tweets after sorting by score\n\n### Best Practices (Avoiding Bans)\n\n- **Use a proxy** — set `TWITTER_PROXY` to avoid direct IP exposure\n- **Keep request volumes low** — use `--max 20` instead of `--max 500`\n- **Don't run too frequently** — each startup fetches x.com to initialize anti-detection headers\n- **Use browser cookie extraction** — provides full cookie fingerprint\n- **Avoid datacenter IPs** — residential proxies are much safer\n\n### Output Modes\n\n- Use the default rich table for interactive reading\n- Use `--full-text` when reading long posts in terminal tables\n- Use `--yaml` or `--json` for scripts and agent pipelines\n- Use `-c` \u002F `--compact` when token efficiency matters more than completeness\n\n### Troubleshooting\n\n- `No Twitter cookies found`\n  - Ensure you are logged in to `x.com` in a supported browser (Arc\u002FChrome\u002FEdge\u002FFirefox\u002FBrave).\n  - Or set `TWITTER_AUTH_TOKEN` and `TWITTER_CT0` manually.\n  - Run with `-v` to see browser extraction diagnostics.\n\n- `Cookie expired or invalid (HTTP 401\u002F403)`\n  - Re-login to `x.com` and retry.\n\n- `Unable to get key for cookie decryption` (macOS Keychain)\n  - **SSH sessions**: Keychain is locked by default over SSH. Run:\n    ```bash\n    security unlock-keychain ~\u002FLibrary\u002FKeychains\u002Flogin.keychain-db\n    ```\n  - **Local terminal**: Open **Keychain Access** → search for **\"\\\u003CBrowser\\> Safe Storage\"** → **Access Control** → add your Terminal app → **Save Changes**.\n  - Or click **\"Always Allow\"** when the Keychain authorization popup appears.\n\n- `Twitter API error 404`\n  - This can happen when upstream GraphQL query IDs rotate.\n  - Retry the command; the client attempts a live queryId fallback.\n\n- `Invalid tweet JSON file`\n  - Regenerate input using `twitter feed --json > tweets.json`.\n\n- **Windows: no output captured by pipe\u002Fsubprocess** (AI agent integration)\n  - This is a **ConPTY** issue, not a twitter-cli bug. Windows Terminal's ConPTY pseudo-terminal can intercept pipe output from commands with network latency.\n  - **Fix**: Use **Git Bash** as your terminal shell and set `\"windowsEnableConpty\": false` in your terminal settings.\n  - If disabling ConPTY with PowerShell, emoji output may fail with `UnicodeEncodeError: 'gbk'`. Git Bash handles UTF-8 natively.\n  - Standard `subprocess.run(capture_output=True)` and file redirection (`> file 2>&1`) work correctly regardless of ConPTY.\n\n\n\nStructured error codes commonly include `not_authenticated`, `not_found`, `invalid_input`, `rate_limited`, and `api_error`.\n\n### Development\n\n```bash\n# Install dev dependencies\nuv sync --extra dev\n\n# Lint + tests\nuv run ruff check .\nuv run pytest -q\n```\n\nCurrent CI validates the project on Python 3.8, 3.10, and 3.12.\n\n### Project Structure\n\n```text\ntwitter_cli\u002F\n├── __init__.py\n├── cli.py\n├── client.py\n├── graphql.py       # GraphQL query IDs, URL building, JS bundle scanning\n├── parser.py        # Tweet, User, Media parsing logic\n├── auth.py\n├── config.py\n├── constants.py\n├── exceptions.py\n├── filter.py\n├── formatter.py\n├── output.py\n├── serialization.py\n└── models.py\n```\n\n### Use as AI Agent Skill\n\ntwitter-cli ships with a [`SKILL.md`](.\u002FSKILL.md) so AI agents can execute common X\u002FTwitter workflows.\n\n#### [Skills CLI](https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fskills) (Recommended)\n\n```bash\nnpx skills add jackwener\u002Ftwitter-cli\n```\n\n| Flag | Description |\n| --- | --- |\n| `-g` | Install globally (user-level, shared across projects) |\n| `-a claude-code` | Target a specific agent |\n| `-y` | Non-interactive mode |\n\n#### Manual Install\n\n```bash\nmkdir -p .agents\u002Fskills\ngit clone git@github.com:jackwener\u002Ftwitter-cli.git .agents\u002Fskills\u002Ftwitter-cli\n```\n\n#### ~~OpenClaw \u002F ClawHub~~ (Deprecated)\n\n> ⚠️ ClawHub install method is deprecated and no longer supported. Use [Skills CLI](#skills-cli-recommended) or Manual Install above.\n\n## 中文\n\n### 功能概览\n\n**读取:**\n- 时间线读取：支持 `for-you` 和 `following`\n- 收藏读取：查看账号书签推文\n- 搜索：按关键词搜索推文，支持 Top\u002FLatest\u002FPhotos\u002FVideos\n- 推文详情：查看推文及其回复；用 `show \u003CN>` 可直接打开上次列表里的第 N 条推文\n- 文章读取：获取 Twitter 长文，并导出为 Markdown\n- 列表时间线：获取 Twitter List 的推文\n- 用户查询：查看用户资料、推文、点赞、粉丝和关注\n- `--full-text`：在 rich table 输出里关闭推文正文截断\n- 结构化输出：支持 YAML 和 JSON，便于脚本处理和 AI agent 集成\n\n> **AI Agent 提示：** 需要结构化输出时优先使用 `--yaml`，除非下游必须是 JSON。stdout 不是 TTY 时默认输出 YAML。用 `--max` 控制返回数量。\n\n**写入:**\n- 发推：发布新推文和回复，支持附带图片（最多 4 张，支持 JPEG\u002FPNG\u002FGIF\u002FWebP）\n- 引用推文：带评论的转发，也支持附带图片\n- 删除：删除自己的推文\n- 点赞 \u002F 取消点赞\n- 转推 \u002F 取消转推\n- 书签 \u002F 取消书签：bookmark\u002Funbookmark（保留 `favorite\u002Funfavorite` 兼容别名）\n- 写操作现在也显式支持 `--json` \u002F `--yaml`\n\n**认证与反风控:**\n- Cookie 认证：支持环境变量和浏览器自动提取\n- 完整 Cookie 转发：提取浏览器中所有 Twitter Cookie，保留更多浏览器上下文\n- TLS 指纹伪装：`curl_cffi` 动态匹配 Chrome 版本\n- `x-client-transaction-id` 请求头生成\n- 请求时序随机化（jitter）\n- 写操作随机延迟（1.5–4 秒），降低频率风控\n- 代理支持：`TWITTER_PROXY` 环境变量\n\n### 安装\n\n```bash\n# 推荐：uv tool\nuv tool install twitter-cli\n```\n\n升级到最新版本：\n\n```bash\nuv tool upgrade twitter-cli\n# 或：pipx upgrade twitter-cli\n```\n\n> **提示：** 建议定期升级，避免因版本过旧导致的 API 调用异常。\n\n### 使用指南\n\n```bash\n# 时间线\ntwitter feed\ntwitter feed -t following\ntwitter feed --filter\ntwitter feed --full-text\ntwitter feed --cursor \"\u003C上一页返回的 nextCursor>\"\n\n# 收藏\ntwitter bookmarks\ntwitter bookmarks --full-text\n\n# 搜索\ntwitter search \"Claude Code\"\ntwitter search \"AI agent\" -t Latest --max 50\ntwitter search \"AI agent\" --full-text\ntwitter search \"topic\" -o results.json         # 保存到文件\ntwitter search \"trending\" --filter              # 启用排序筛选\n\n# 推文详情\ntwitter tweet 1234567890\ntwitter tweet 1234567890 --full-text\n\n# 通过序号打开上次列表里的推文\ntwitter show 2                         # 打开上次 feed\u002Fsearch 的第 2 条\ntwitter show 2 --full-text             # 在回复表格里显示完整正文\ntwitter show 2 --json                  # 结构化输出\n\n# Twitter 长文\ntwitter article 1234567890\ntwitter article https:\u002F\u002Fx.com\u002Fuser\u002Farticle\u002F1234567890 --json\ntwitter article 1234567890 --markdown\ntwitter article 1234567890 --output article.md\n\n# 列表时间线\ntwitter list 1539453138322673664\ntwitter list 1539453138322673664 --cursor \"\u003C上一页返回的 nextCursor>\"\ntwitter list 1539453138322673664 --full-text\n\n# 用户\ntwitter user elonmusk\ntwitter user-posts elonmusk --max 20\ntwitter user-posts elonmusk --full-text\ntwitter user-posts elonmusk -o tweets.json\ntwitter likes elonmusk --max 30           # ⚠️ 仅可查看自己的点赞（2024年6月起平台已私密化）\ntwitter likes elonmusk --full-text\ntwitter likes elonmusk -o likes.json\ntwitter followers elonmusk\ntwitter following elonmusk\n\n# 写操作\ntwitter post \"你好，世界！\"\ntwitter post \"发图\" --image photo.jpg              # 带图发推\ntwitter post \"多图\" -i a.png -i b.jpg -i c.webp    # 最多 4 张图片\ntwitter post \"回复内容\" --reply-to 1234567890\ntwitter reply 1234567890 \"回复\" -i screenshot.png   # 带图回复\ntwitter quote 1234567890 \"评论\" -i chart.png        # 带图引用\ntwitter post \"你好，世界！\" --json\ntwitter delete 1234567890\ntwitter like 1234567890\ntwitter like 1234567890 --yaml\ntwitter unlike 1234567890\ntwitter retweet 1234567890\ntwitter unretweet 1234567890\ntwitter bookmark 1234567890\ntwitter unbookmark 1234567890\ntwitter follow elonmusk --json\n```\n\n### 认证说明\n\n认证优先级：\n\n1. **环境变量**：`TWITTER_AUTH_TOKEN` + `TWITTER_CT0`\n2. **浏览器提取**（推荐）：Arc\u002FChrome\u002FEdge\u002FFirefox\u002FBrave 全量 Cookie 提取\n\n推荐使用浏览器提取方式，会转发所有 Twitter Cookie，并按本机运行环境生成语言和平台请求头；它比仅发送 `auth_token` + `ct0` 更接近普通浏览器流量，但不等于完整浏览器自动化。\n\n**Chrome 多 Profile 支持**：会自动遍历所有 Chrome profile。也可以通过环境变量指定：\n\n```bash\nTWITTER_CHROME_PROFILE=\"Profile 2\" twitter feed\n```\n\n**浏览器优先级**：如果有多个浏览器，可通过 `TWITTER_BROWSER` 指定优先尝试的浏览器：\n\n```bash\nTWITTER_BROWSER=chrome twitter feed    # 支持: arc, chrome, edge, firefox, brave\n```\n\n### 代理支持\n\n设置 `TWITTER_PROXY` 环境变量即可：\n\n```bash\nexport TWITTER_PROXY=http:\u002F\u002F127.0.0.1:7890\n# 或 SOCKS5\nexport TWITTER_PROXY=socks5:\u002F\u002F127.0.0.1:1080\n```\n\n使用代理可以降低 IP 维度的风控风险。\n\n### 筛选算法\n\n未传 `--max` 时，所有读取命令默认使用 `config.yaml` 里的 `fetch.count`。\n\nrich table 输出默认会截断较长正文；如果需要在列表视图中查看完整正文，可加 `--full-text`。\n\n只有在传入 `--filter` 时才会启用筛选评分；默认不筛选。\n\n评分公式：\n\n```text\nscore = likes_w * likes\n      + retweets_w * retweets\n      + replies_w * replies\n      + bookmarks_w * bookmarks\n      + views_log_w * log10(max(views, 1))\n```\n\n模式说明：\n\n- `mode: \"topN\"`：按分数排序后保留前 `topN` 条\n- `mode: \"score\"`：仅保留 `score >= minScore` 的推文\n- `mode: \"all\"`：按分数排序后全部保留\n\n### 常见问题\n\n- 报错 `No Twitter cookies found`：请先登录 `x.com`，并确认浏览器为 Arc\u002FChrome\u002FEdge\u002FFirefox\u002FBrave 之一，或手动设置环境变量。\n- 如需查看浏览器提取细节，可加 `-v` 打开诊断日志。\n- 报错 `Cookie expired or invalid`：Cookie 过期，重新登录后重试。\n- 报错 `Unable to get key for cookie decryption`（macOS Keychain 问题）：\n  - **SSH 远程登录**：Keychain 默认锁定，需手动解锁：\n    ```bash\n    security unlock-keychain ~\u002FLibrary\u002FKeychains\u002Flogin.keychain-db\n    ```\n  - **本地终端**：打开 **钥匙串访问** → 搜索 **\"\\\u003C浏览器\\> Safe Storage\"** → **访问控制** → 添加你的终端 app → **保存更改**。\n  - 或在弹出 Keychain 授权时点击 **\"始终允许\"**。\n- 报错 `Twitter API error 404`：通常是 queryId 轮换，重试即可。\n\n- **Windows 下 pipe\u002Fsubprocess 无法捕获输出**（AI agent 集成场景）\n  - 这是 **ConPTY** 伪终端的问题，不是 twitter-cli 的 bug。Windows Terminal 的 ConPTY 可能拦截有网络延迟的命令的管道输出。\n  - **解决方案**：使用 **Git Bash** 并在终端设置中设置 `\"windowsEnableConpty\": false`。\n  - ConPTY 关闭后如用 PowerShell，emoji 可能会报 `UnicodeEncodeError: 'gbk'`。Git Bash 原生支持 UTF-8。\n  - 标准 `subprocess.run(capture_output=True)` 和文件重定向 (`> file 2>&1`) 不受此问题影响。\n\n\n\n- 结构化错误码通常会区分 `not_authenticated`、`not_found`、`invalid_input`、`rate_limited`、`api_error`。\n\n### 使用建议（防封号）\n\n- **使用代理** — 设置 `TWITTER_PROXY`，避免裸 IP 直连\n- **控制请求量** — 用 `--max 20` 而不是 `--max 500`\n- **避免频繁启动** — 每次启动都会访问 x.com 初始化反检测请求头\n- **使用浏览器 Cookie 提取** — 提供完整 Cookie 指纹\n- **避免数据中心 IP** — 住宅代理更安全\n- Cookie 仅在本地使用，不会被本工具上传\n\n### 输出模式建议\n\n- 默认 rich table 适合终端交互式浏览\n- 需要在表格里看完整正文时，使用 `--full-text`\n- 需要脚本消费时，优先使用 `--yaml` 或 `--json`\n- 需要节省 token 时，使用 `-c` \u002F `--compact`\n\n### 作为 AI Agent Skill 使用\n\ntwitter-cli 提供了 [`SKILL.md`](.\u002FSKILL.md)，可让 AI Agent 更稳定地调用本工具。\n\n#### [Skills CLI](https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fskills)（推荐）\n\n```bash\nnpx skills add jackwener\u002Ftwitter-cli\n```\n\n| 参数 | 说明 |\n| --- | --- |\n| `-g` | 全局安装（用户级别，跨项目共享） |\n| `-a claude-code` | 指定目标 Agent |\n| `-y` | 非交互模式 |\n\n#### 手动安装\n\n```bash\nmkdir -p .agents\u002Fskills\ngit clone git@github.com:jackwener\u002Ftwitter-cli.git .agents\u002Fskills\u002Ftwitter-cli\n```\n\n#### ~~OpenClaw \u002F ClawHub~~（已过时）\n\n> ⚠️ ClawHub 安装方式已过时，不再支持。请使用上方的 Skills CLI 或手动安装。\n\n### 更多工具\n\n- [bilibili-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Fbilibili-cli) — Bilibili 视频、用户、搜索与动态 CLI\n- [discord-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Fdiscord-cli) — Discord 本地优先同步、检索与导出 CLI\n- [tg-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Ftg-cli) — Telegram 本地优先同步、检索与导出 CLI\n- [xiaohongshu-cli](https:\u002F\u002Fgithub.com\u002Fjackwener\u002Fxiaohongshu-cli) — 小红书笔记与账号工作流 CLI\n","twitter-cli 是一个用于在终端中浏览 Twitter\u002FX 的命令行工具，支持查看时间线、收藏和用户动态。其核心功能包括阅读个人时间线、收藏推文、搜索推文及查看用户资料等，无需使用 API 密钥。此外，它还提供了发布新推文、回复、删除推文等功能，并支持图片附件。技术特点方面，项目采用了 Python 语言编写，具备丰富的认证机制和反检测措施，如 Cookie 认证、TLS 指纹伪装等，确保了较高的安全性和稳定性。适用于需要通过命令行高效管理 Twitter 账户的开发者或高级用户，在进行数据分析、自动化操作时尤为方便。",2,"2026-06-11 03:48:58","high_star"]