Native Rust CLI for Twitter & X
Search tweets, scrape user timelines, and extract complete conversation threads via Apify. Built in native Rust 2024 with YAML-first output and JSON mode optimized for LLM agents.
cargo install --git https://github.com/SpaceCorps/Twitter-Cli --locked
Engineered for Developers & Autonomous Agents
Zero runtime dependencies, sub-3ms cold starts, and deterministic multi-account safety.
Native Speed & Zero Bloat
Compiles down to a single standalone static binary with zero runtime dependencies. Executes in 1–3 ms, eliminating interpreter startup delays.
Agentic Output Protocol
Dual-mode rendering: clean, token-efficient YAML on stdout for human and LLM terminal inspection, or raw structured JSON with --json for pipeline loops.
OS Keystore Security
API tokens are stored in hardware-backed OS credential stores (macOS Keychain, Windows DPAPI, Linux Secret Service). Secrets never touch plaintext disk files.
Deterministic Multi-Account
Explicit account resolution (--account <name>) prevents cross-account token collisions and accidental quota depletion in multi-tenant environments.
Rich Query & Filter Capabilities
Filter tweets by language, verified status, media type (images, videos), and date ranges (--since, --until). Sort by Latest or Top.
Self-Documenting Agent Manual
Built-in twitter agent-readme [--json] exposes complete operating manuals, rules, and exit code mappings directly to LLMs with zero network roundtrips.
Command Examples
Explore interactive terminal workflows for search, scraping, and account management.
# Search recent tweets matching a query twitter search "agentic coding" # Search top tweets with max items and media filter twitter search "Claude Code" --sort Top --max 10 # Filter by language and date window twitter search "AI coding" --lang en --since 2025-01-01 --until 2025-12-31 # Only verified users with images twitter search "developer tools" --verified --images # Pipe structured JSON into jq twitter search "rust lang" --json | jq '.[0].text'
# Scrape a user profile timeline twitter scrape "https://x.com/username" --max 50 # Scrape using Twitter handle directly twitter scrape "@username" --max 20 # Scrape a specific tweet and thread twitter scrape "https://x.com/username/status/123456789" # Include followers list for a profile twitter scrape "https://x.com/username" --followers --max 100
# Log in interactively (opens browser to copy Apify token) twitter login # Non-interactive login from environment echo "$APIFY_TOKEN" | twitter login work --api-key-stdin # List configured accounts and test validity twitter accounts list --check # Test account connectivity and inspect token identity twitter accounts test work # Remove stored account twitter accounts remove work --yes
| Command | Description | Primary Flags |
|---|---|---|
twitter search <query> |
Search Twitter/X for tweets matching query | --max, --sort, --lang, --verified, --images, --videos, --since, --until |
twitter scrape <url> |
Scrape a profile, tweet, or conversation thread | --max, --followers, --following, --retweeters |
twitter me |
Get current Apify identity and plan context | -a, --account, --api-key |
twitter login [<name>] |
Authenticate via Apify token and store in OS keystore | --api-key, --api-key-stdin, --no-browser, --force |
twitter accounts list |
List configured accounts and key status | --check |
twitter agent-readme |
Print full markdown or JSON agent manual | --json |