Twitter/X browser automation
v1.0.13 • by cliforai • Updated 2 days ago • BUSL-1.1 License
$ cli4ai add twitter About
@cli4ai/twitter
Official @cli4ai package • https://cli4ai.com • Install cli4ai:
npm i -g cli4ai
X/Twitter automation via Puppeteer. Requires Chrome running with remote debugging.
Setup
npm i -g cli4ai
cli4ai add -g chrome twitter
- Start Chrome with remote debugging (see
@cli4ai/chrome), then:
cli4ai run chrome connect
- Make sure you’re logged into X/Twitter in that Chrome session.
Commands
Core
cli4ai run twitter timeline [count] # Home timeline
cli4ai run twitter notifications [count] # Your notifications
cli4ai run twitter search "<query>" [count] # Search tweets
cli4ai run twitter post "<message>" # Post a tweet
cli4ai run twitter reply <url> "<message>" # Reply to a tweet
cli4ai run twitter profile <handle> # Get user profile
cli4ai run twitter digest [handles...] # Last 24h tweets
Trend Analysis
cli4ai run twitter trends [location] # Current trending topics
cli4ai run twitter analytics <handle> [n] # Engagement stats for user's tweets
cli4ai run twitter tweet <url> # Detailed stats for single tweet
cli4ai run twitter mentions "<query>" [n] # Track mentions/topic with engagement
Network Analysis
cli4ai run twitter followers <handle> [n] # List followers with their stats
cli4ai run twitter following <handle> [n] # List who they follow
cli4ai run twitter engagers <handle> [n] # Top accounts engaging with user
Advanced
cli4ai run twitter compare <h1> <h2> # Side-by-side account comparison
cli4ai run twitter likes <handle> [n] # What they've liked recently
cli4ai run twitter bookmarks [n] # Your saved tweets
cli4ai run twitter lists <handle> # User's lists
Examples
# What's trending right now?
cli4ai run twitter trends
# Get engagement analytics for a user
cli4ai run twitter analytics steipete 20
# Returns: avg likes/retweets/views, engagement rate, top tweets
# Deep dive on a specific tweet
cli4ai run twitter tweet "https://x.com/elonmusk/status/123456789"
# Returns: full engagement (replies, retweets, likes, bookmarks, views), engagement rate
# Track mentions of a topic or user
cli4ai run twitter mentions "claude AI" 20
cli4ai run twitter mentions "@anthropic" 10
# Returns: tweets with engagement stats, total/avg engagement
# Daily digest from specific accounts
cli4ai run twitter digest steipete badlogicgames
# Network analysis
cli4ai run twitter followers steipete 20 # Who follows them
cli4ai run twitter following elonmusk 10 # Who they follow
cli4ai run twitter engagers steipete # Top accounts engaging (visits likes/RTs pages)
# Advanced
cli4ai run twitter compare steipete badlogicgames # Side-by-side comparison
cli4ai run twitter likes steipete 10 # What they've liked
cli4ai run twitter bookmarks 20 # Your saved tweets
cli4ai run twitter lists someuser # User's public lists
Output
All commands output JSON for easy piping:
# Get top trending topic
cli4ai run twitter trends | jq '.[0]'
# Get engagement rate for a user
cli4ai run twitter analytics steipete 10 | jq '.engagementRate'
# Get views on a tweet
cli4ai run twitter tweet "https://x.com/user/status/123" | jq '.engagement.views'
Keywords
Related Packages
gmail
v1.0.11 • by cliforai
Gmail CLI tool for messages, threads, and drafts
#gmail
#email
#google
0 downloads
v1.0.12 • by cliforai
LinkedIn tools - READ ONLY (15 req/hour, human-like delays)
#linkedin
#social
#professional
0 downloads
slack
v1.0.13 • by cliforai
Slack CLI tool for messages, channels, and users
#slack
#messaging
#chat
0 downloads