Scan your whole stack
From OX Research Newsroom
Are you using twitter-cli?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.9.0
twitter-cli was last scanned on 29 Nov 2026 at version 0.9.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.9.0 LATEST | 29 Nov 2026 | No rules fired |
Findings for v0.9.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.9.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
A terminal-first CLI for Twitter/X: read timelines, bookmarks, and user profiles without API keys.
English | 中文
Read:
for-you and following feeds--cursor pagination and bookmark folders)twitter news)--cursor pagination); use show <N> to open tweet #N from the last list output@handle or numeric user ID), tweets, likes, followers, and following--full-text for untruncated tables, --time relative|absolute|iso for timestamps, completion bash|zsh|fish, and doctor [--refresh]TwitterClient, get_cookies, models, and serializers directly from twitter_cliAI Agent Tip: Prefer
--yamlfor structured output unless a strict JSON parser is required. Non-TTY stdout defaults to YAML automatically. Use--maxto limit results.
Write:
--video / -V, MP4/MOV/WebM up to 512 MB)CreateNoteTweet (X Premium)twitter article-publish)favorite/unfavorite kept as compatibility aliases)--json / --yaml output nowAuth & Anti-Detection:
TWITTER_COOKIE_STRING or TWITTER_AUTH_TOKEN + TWITTER_CT0)curl_cffi with dynamic Chrome version matchingx-client-transaction-id header generation with fail-closed protection on unsigned POST mutationsqueryId resolution with 24h local cache and TWITTER_QID_<OP> overridesTWITTER_PROXY environment variable# Recommended: uv tool (fast, isolated)
uv tool install twitter-cli
# Alternative: pipx
pipx install twitter-cli
Upgrade to the latest version:
uv tool upgrade twitter-cli
# Or: pipx upgrade twitter-cli
Tip: Upgrade regularly to avoid unexpected errors from outdated API handling.
Install from source:
git clone git@github.com:jackwener/twitter-cli.git
cd twitter-cli
uv sync
# Fetch home timeline (For You)
twitter feed
# Fetch Following timeline
twitter feed -t following
# Enable ranking filter explicitly
twitter feed --filter
# Feed
twitter feed --max 50
twitter feed --cursor "<next-cursor-from-previous-response>"
twitter feed --full-text
twitter feed --output tweets.json
twitter feed --input tweets.json
twitter feed --json # Structured stdout for scripts/agents
# Bookmarks
twitter bookmarks
twitter bookmarks --cursor "<next-cursor-from-previous-response>"
twitter bookmarks --full-text
twitter bookmarks --max 30 --yaml
# Explore News
twitter news --max 20
twitter news --json
# Search
twitter search "Claude Code"
twitter search "AI agent" -t Latest --max 50
twitter search "AI agent" --full-text
twitter search "机器学习" --yaml
twitter search "python" --from elonmusk --lang en --since 2026-01-01
twitter search --from bbc --exclude retweets --has links
twitter search "topic" -o results.json # Save to file
twitter search "trending" --filter # Apply ranking filter
# Tweet detail (view tweet + replies)
twitter tweet 1234567890
twitter tweet 1234567890 --cursor "<next-cursor>"
twitter tweet 1234567890 --full-text
twitter tweet https://x.com/user/status/1234567890
# Open tweet by index from last list output
twitter show 2 # Open tweet #2 from last feed/search
twitter show 2 --full-text # Full text in reply table
twitter show 2 --json # Structured output
# Twitter Article (read & publish)
twitter article 1234567890
twitter article https://x.com/user/article/1234567890 --json
twitter article 1234567890 --markdown
twitter article 1234567890 --output article.md
twitter article-publish post.md --title "My Article" # Publish X Article
twitter article-publish post.md --title "My Draft" --draft # Save as draft
# List timeline
twitter list 1539453138322673664
twitter list 1539453138322673664 --cursor "<next-cursor-from-previous-response>"
twitter list 1539453138322673664 --full-text
# User (accepts @handle or numeric user ID)
twitter user elonmusk
twitter user 44196397
twitter user-posts elonmusk --max 20
twitter user-posts elonmusk --full-text
twitter user-posts elonmusk -o tweets.json
twitter likes elonmusk --max 30 # ⚠️ own likes only (private since Jun 2024)
twitter likes elonmusk --full-text
twitter likes elonmusk -o likes.json
twitter followers elonmusk --max 50
twitter following elonmusk --max 50
# Write operations
twitter post "Hello from twitter-cli!"
twitter post "Hello!" --image photo.jpg # Post with image
twitter post "Gallery" -i a.png -i b.jpg -i c.webp # Up to 4 images
twitter post "Demo clip" --video clip.mp4 # Post with video (up to 512 MB)
twitter post "reply text" --reply-to 1234567890
twitter reply 1234567890 "Nice!" -i screenshot.png # Reply with image
twitter quote 1234567890 "Look" -i chart.png # Quote with image
twitter post "Hello from twitter-cli!" --json
twitter delete 1234567890
twitter like 1234567890
twitter like 1234567890 --yaml
twitter unlike 1234567890
twitter retweet 1234567890
twitter unretweet 1234567890
twitter bookmark 1234567890
twitter unbookmark 1234567890
twitter follow elonmusk --json
# Display, completion & diagnostics
twitter --time relative feed # relative | absolute | iso
twitter completion zsh # bash | zsh | fish
twitter doctor # Check deps, config, auth presence, caches
twitter doctor --refresh # Refresh cached GraphQL query IDs
from twitter_cli import TwitterClient, get_cookies
cookies = get_cookies()
client = TwitterClient(
cookies["auth_token"],
cookies["ct0"],
cookie_string=cookies.get("cookie_string"),
)
tweets = client.fetch_home_timeline(count=20)
for tweet in tweets:
print(f"@{tweet.author.screen_name}: {tweet.text[:80]}")
twitter-cli uses this auth priority:
TWITTER_COOKIE_STRING (full Cookie: header; auto-extracts auth_token + ct0 while keeping all session cookies — great for remote servers, SigCLI, or Windows Chrome >=127)TWITTER_AUTH_TOKEN + TWITTER_CT0Browser extraction is recommended locally — 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.
Chrome multi-profile: All Chrome profiles are scanned automatically. To specify a profile:
TWITTER_CHROME_PROFILE="Profile 2" twitter feed
Custom Chromium directory: For Chromium, Opera, Brave/Chrome custom data dirs, or portable builds:
TWITTER_CHROMIUM_USER_DATA_DIR="/path/to/User Data" twitter feed
Browser priority: If you have multiple browsers, set TWITTER_BROWSER to try a specific browser first:
TWITTER_BROWSER=chrome twitter feed # Supported: arc, chrome, edge, firefox, brave, vivaldi, zen
After loading cookies, the CLI performs lightweight verification. Commands that require account access fail fast on clear auth errors (401/403).
Advanced GraphQL & Transaction env vars:
TWITTER_QID_<OPERATION>=<queryId> — override a specific GraphQL queryId (e.g. TWITTER_QID_HomeTimeline=...)TWITTER_ALLOW_UNSIGNED=1 — opt-in bypass if x-client-transaction-id cannot be generated on write (POST) requests (fails closed by default to prevent 226 anti-bot flags)Set TWITTER_PROXY to route all requests through a proxy:
# HTTP proxy
export TWITTER_PROXY=http://127.0.0.1:7890
# SOCKS5 proxy
export TWITTER_PROXY=socks5://127.0.0.1:1080
Using a proxy can help reduce IP-based rate limiting risks.
Create config.yaml in your working directory or ~/.twitter-cli/config.yaml (search order: explicit path → ./config.yaml → ~/.twitter-cli/config.yaml → built-in defaults):
fetch:
count: 50
display:
time: "relative" # "relative" | "absolute" | "iso"
filter:
mode: "topN" # "topN" | "score" | "all"
topN: 20
minScore: 50
lang: []
excludeRetweets: false
weights:
likes: 1.0
retweets: 3.0
replies: 2.0
bookmarks: 5.0
views_log: 0.5
rateLimit:
requestDelay: 2.5 # base delay between requests (randomized ×0.7–1.5)
maxRetries: 3 # retry count on rate limit (429)
retryBaseDelay: 5.0 # base delay for exponential backoff
maxCount: 200 # default pagination cap (explicit --max can exceed up to 10,000)
Fetch behavior:
fetch.count is the default item count for read commands when --max is omitted--full-text to show full body text in list viewsFilter behavior:
--filter is passed--filter: tweets are scored/sorted using config.filterScoring formula:
score = likes_w * likes
+ retweets_w * retweets
+ replies_w * replies
+ bookmarks_w * bookmarks
+ views_log_w * log10(max(views, 1))
Mode behavior:
mode: "topN" keeps the highest topN tweets by scoremode: "score" keeps tweets where score >= minScoremode: "all" returns all tweets after sorting by scoreTWITTER_PROXY to avoid direct IP exposure--max 20 instead of --max 500--full-text when reading long posts in terminal tables--yaml or --json for scripts and agent pipelines-c / --compact when token efficiency matters more than completenessNo Twitter cookies found
x.com in a supported browser (Arc/Chrome/Edge/Firefox/Brave/Vivaldi/Zen) or point to a custom directory with TWITTER_CHROMIUM_USER_DATA_DIR.TWITTER_COOKIE_STRING (recommended for headless/Windows Chrome >=127) or TWITTER_AUTH_TOKEN + TWITTER_CT0 manually.-v or twitter doctor to see diagnostics.Cookie expired or invalid (HTTP 401/403)
x.com and retry.Unable to get key for cookie decryption (macOS Keychain)
security unlock-keychain ~/Library/Keychains/login.keychain-db
Twitter API error 404
Invalid tweet JSON file
twitter feed --json > tweets.json.Windows: no output captured by pipe/subprocess (AI agent integration)
"windowsEnableConpty": false in your terminal settings.UnicodeEncodeError: 'gbk'. Git Bash handles UTF-8 natively.subprocess.run(capture_output=True) and file redirection (> file 2>&1) work correctly regardless of ConPTY.Structured error codes commonly include not_authenticated, not_found, invalid_input, rate_limited, network_error, query_id_error, media_upload_error, and api_error.
# Install dev dependencies
uv sync --extra dev
# Lint + tests
uv run ruff check .
uv run pytest -q
Current CI validates the project on Python 3.10, 3.11, 3.12, and 3.13.
twitter_cli/
├── __init__.py # Public Python library exports
├── article.py # Markdown -> Draft.js content_state builder for X Articles
├── auth.py # Browser cookie extraction & env auth
├── cache.py # Owner-only local cache helpers
├── cli.py # Click CLI commands
├── client.py # HTTP/GraphQL/media client & ClientTransaction bootstrap
├── config.py # YAML configuration loader
├── constants.py
├── exceptions.py
├── filter.py
├── formatter.py
├── graphql.py # GraphQL query IDs, disk cache, live JS bundle scanning
├── models.py
├── output.py
├── parser.py # Tweet, User, Media, Article Draft.js parsing
├── search.py # Advanced search query builder
├── serialization.py
├── text.py # twitter-text v3 weighted character length
└── timeutil.py
twitter-cli ships with a SKILL.md so AI agents can execute common X/Twitter workflows.
npx skills add jackwener/twitter-cli
| Flag | Description |
|---|---|
-g |
Install globally (user-level, shared across projects) |
-a claude-code |
Target a specific agent |
-y |
Non-interactive mode |
mkdir -p .agents/skills
git clone git@github.com:jackwener/twitter-cli.git .agents/skills/twitter-cli Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.