twitter-cli
БесплатноБез исполняемых скриптовНе проверенUse twitter-cli for ALL Twitter/X operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, user lookups. Invoke…
от jackwener★ 3 043 звезды на GitHubОб этом скилле
twitter-cli — Twitter/X CLI Tool
Binary: twitter
Credentials: browser cookies (auto-extracted) or env vars
Setup
# Install (requires Python 3.10+)
uv tool install twitter-cli
# Or: pipx install twitter-cli
# Upgrade to latest (recommended to avoid API errors)
uv tool upgrade twitter-cli
# Or: pipx upgrade twitter-cli
Authentication
IMPORTANT FOR AGENTS: Before executing ANY twitter-cli command, you MUST first check if credentials exist. If not, you MUST proactively guide the user through the authentication process. Do NOT assume credentials are configured.
CRITICAL: Write operations (posting tweets, replying, quoting) REQUIRE full browser cookies. Only providing auth_token + ct0 via env vars may result in 226 error ("looks like automated behavior"). For best results, use browser cookie extraction or TWITTER_COOKIE_STRING (full Cookie: header).
Step 0: Check if already authenticated
twitter status --yaml >/dev/null && echo "AUTH_OK" || echo "AUTH_NEEDED"
If AUTH_OK, skip to Command Reference.
If AUTH_NEEDED, proceed to guide the user:
Step 1: Guide user to authenticate
Method A: Browser cookie extraction (recommended)
Ensure user is logged into x.com in one of: Arc, Chrome, Edge, Firefox, Brave, Vivaldi, Zen. twitter-cli auto-extracts cookies.
All Chrome profiles are scanned automatically. To specify a profile: TWITTER_CHROME_PROFILE="Profile 2" twitter feed.
To point to a custom Chromium user data directory (e.g., Chromium, Opera, portable Chrome): TWITTER_CHROMIUM_USER_DATA_DIR="/path/to/User Data" twitter feed.
To prioritize a specific browser: TWITTER_BROWSER=chrome twitter feed (supported: arc, chrome, edge, firefox, brave, vivaldi, zen).
twitter whoami
Method B: Environment variables
export TWITTER_AUTH_TOKEN="<auth_token from browser>"
export TWITTER_CT0="<ct0 from browser>"
twitter whoami
Method C: Full cookie string (recommended for cloud/remote agents & Windows Chrome >=127)
Pass the full browser Cookie: header via TWITTER_COOKIE_STRING (preserves all session/anti-bot cookies and auto-extracts auth_token + ct0):
export TWITTER_COOKIE_STRING="auth_token=...; ct0=...; twid=..."
twitter whoami
If asking the user to copy it:
我需要你的 Twitter 登录凭证。请按以下步骤获取:
- 用 Chrome/Edge/Firefox 打开 https://x.com(确保已登录)
- 按
F12打开开发者工具 → Network 标签- 在页面上刷新,点击任意
x.com请求- 找到 Request Headers → Cookie: 这一行,右键 → 复制值
- 把完整 Cookie 字符串设置为
TWITTER_COOKIE_STRING环境变量(⚠️ Cookie 包含登录信息,请不要分享给其他人)。
Step 2: Handle common auth issues
| Symptom | Agent action |
|---|---|
No Twitter cookies found |
Guide user to login to x.com in browser, or set env vars |
| Read works, write returns 226 | Full cookies missing — use browser cookie extraction or TWITTER_COOKIE_STRING instead of minimal auth_token/ct0 env vars |
Cookie expired (401/403) |
Ask user to re-login to x.com and retry |
| User changed password | All old cookies invalidated — re-extract |
Output Format
Default: Rich table (human-readable)
twitter feed # Pretty table output
YAML / JSON: structured output
Non-TTY stdout defaults to YAML automatically. Use OUTPUT=yaml|json|rich|auto to override.
twitter feed --yaml
twitter feed --json | jq '.data[0].text'
All machine-readable output uses the envelope documented in SCHEMA.md.
Tweet and user payloads now live under .data.
Full text: --full-text flag (rich tables only)
Use --full-text when the user wants complete post bodies in terminal tables.
It affects rich table list views such as feed, bookmarks, search, user-posts, likes, list, and reply tables in tweet.
It does not change --json, --yaml, or -c compact output.
twitter feed --full-text
twitter search "AI agent" --full-text
twitter user-posts elonmusk --max 20 --full-text
twitter tweet 1234567890 --full-text
Compact: -c flag (minimal tokens for LLM)
twitter -c feed --max 10 # Minimal fields, great for LLM context
twitter -c search "AI" --max 20 # ~80% fewer tokens than --json
Compact fields (per tweet): id, author (@handle), text (truncated 140 chars), likes, rts, time (short format)
Command Reference
Read Operations
twitter status # Quick auth check
twitter status --yaml # Structured auth status
twitter doctor # Diagnostics (deps, config, auth presence, caches)
twitter doctor --refresh # Refresh cached GraphQL query IDs
twitter whoami # Current authenticated user
twitter whoami --yaml # YAML output
twitter whoami --json # JSON output
twitter user elonmusk # User profile (screen
Установить twitter-cli в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл twitter-cli?
Use twitter-cli for ALL Twitter/X operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, user lookups. Invoke whenever user requests any Twitter interaction.
Как установить скилл twitter-cli?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл twitter-cli запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic