Loading...
Loading...
Terminal-first Twitter/X CLI for reading feeds, bookmarks, search, and posting tweets without API keys
npx skill4agent add aradotso/devtools-skills twitter-cli-skillSkill by ara.so — Devtools Skills collection.
twitter-cli--json--yaml# Recommended: uv tool (fast, isolated)
uv tool install twitter-cli
# Alternative: pipx
pipx install twitter-cli
# Upgrade to latest
uv tool upgrade twitter-cligit clone git@github.com:jackwener/twitter-cli.git
cd twitter-cli
uv syncTWITTER_AUTH_TOKENTWITTER_CT0# Auto-detect browser and extract all Twitter cookies
twitter feed
# Specify browser explicitly
TWITTER_BROWSER=chrome twitter feed
# Chrome multi-profile
TWITTER_CHROME_PROFILE="Profile 2" twitter feedexport TWITTER_AUTH_TOKEN="your_auth_token"
export TWITTER_CT0="your_ct0_token"
twitter feedexport TWITTER_PROXY=http://127.0.0.1:7890
# or
export TWITTER_PROXY=socks5://127.0.0.1:1080# For You feed (default)
twitter feed
# Following feed
twitter feed -t following
# Limit results
twitter feed --max 20
# Full text (no truncation)
twitter feed --full-text
# Structured output for agents
twitter feed --json
twitter feed --yaml
# With ranking filter
twitter feed --filter --max 50
# Pagination cursor
twitter feed --cursor "DAABCgABGdE..."# Basic search
twitter search "AI agent"
# Search type: Top, Latest, Photos, Videos
twitter search "machine learning" -t Latest
# Full text + JSON output
twitter search "python" --full-text --json
# Advanced filters
twitter search "climate" --from scientist --lang en --since 2026-01-01
twitter search "news" --exclude retweets --has links
# Save to file
twitter search "trending" -o results.json
# Apply ranking filter
twitter search "tech" --filter# List bookmarks
twitter bookmarks
# Limit + full text
twitter bookmarks --max 30 --full-text
# Export as YAML
twitter bookmarks --yaml# By tweet ID
twitter tweet 1234567890
# By URL
twitter tweet https://x.com/user/status/1234567890
# Full text in reply table
twitter tweet 1234567890 --full-text
# Structured output
twitter tweet 1234567890 --json# After running `twitter feed` or `twitter search`:
twitter show 2 # Open tweet #2 from last list
twitter show 2 --full-text
twitter show 2 --json# By article ID
twitter article 1234567890
# By URL
twitter article https://x.com/user/article/1234567890
# Export as Markdown
twitter article 1234567890 --markdown
twitter article 1234567890 --output article.md
# JSON output
twitter article 1234567890 --json# Fetch tweets from a Twitter List
twitter list 1539453138322673664
# Pagination
twitter list 1539453138322673664 --cursor "DAABCgABGdE..."
# Full text
twitter list 1539453138322673664 --full-text# Profile
twitter user elonmusk
# User tweets
twitter user-posts elonmusk --max 20
twitter user-posts elonmusk --full-text -o tweets.json
# User likes (own account only, private since Jun 2024)
twitter likes elonmusk --max 30
# Followers
twitter followers elonmusk --max 50
# Following
twitter following elonmusk --max 50# Simple tweet
twitter post "Hello from twitter-cli!"
# Tweet with image (up to 4)
twitter post "Hello!" --image photo.jpg
twitter post "Gallery" -i a.png -i b.jpg -i c.webp
# Structured output
twitter post "Hello from twitter-cli!" --json# Reply to tweet
twitter post "Nice!" --reply-to 1234567890
# Reply with image
twitter reply 1234567890 "Great!" -i screenshot.png# Quote with text
twitter quote 1234567890 "Check this out"
# Quote with image
twitter quote 1234567890 "Look at this chart" -i chart.pngtwitter delete 1234567890twitter like 1234567890
twitter like 1234567890 --yaml
twitter unlike 1234567890twitter retweet 1234567890
twitter unretweet 1234567890twitter bookmark 1234567890
twitter unbookmark 1234567890twitter follow elonmusk --json
twitter unfollow elonmuskconfig.yamlfetch:
count: 50
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 (randomized ×0.7–1.5)
maxRetries: 3
retryBaseDelay: 5.0
maxCount: 200score = likes_w * likes
+ retweets_w * retweets
+ replies_w * replies
+ bookmarks_w * bookmarks
+ views_log_w * log10(max(views, 1))topNscoreall--json--yamlimport subprocess
import yaml
result = subprocess.run(
["twitter", "feed", "--max", "10", "--yaml"],
capture_output=True,
text=True,
check=True
)
data = yaml.safe_load(result.stdout)
for tweet in data["tweets"]:
print(f"{tweet['author']['username']}: {tweet['text']}")import subprocess
import json
result = subprocess.run(
["twitter", "post", "Hello from Python!", "--json"],
capture_output=True,
text=True,
check=True
)
response = json.loads(result.stdout)
print(f"Tweet ID: {response['tweetId']}")# Get top 10 AI tweets from today as JSON
twitter search "AI agent" --since 2026-05-17 --filter --max 10 --jsontwitter bookmarks --max 100 --json > bookmarks.json# Fetch latest 5 tweets from user
twitter user-posts elonmusk --max 5 --yaml# Top 10 tweets about "AI" by score
twitter search "AI" --filter --max 10 --full-texttwitter post "My photo gallery" -i img1.jpg -i img2.png -i img3.webptwitter reply 1234567890 "Here's the screenshot" -i screenshot.pngtwitter article 1234567890 --markdown --output ~/articles/ai-safety.mdexport TWITTER_PROXY=http://127.0.0.1:7890
twitter feed --max 20x.comTWITTER_AUTH_TOKENTWITTER_CT0-vtwitter -v feedx.comsecurity unlock-keychain ~/Library/Keychains/login.keychain-dbtwitter feed --json > tweets.json"windowsEnableConpty": falsesubprocess.run(capture_output=True)--maxTWITTER_PROXYrateLimit.requestDelayconfig.yamlTWITTER_PROXY--max 20--max 500uv tool upgrade twitter-cli--full-text--yaml--json-c--compact-o FILE# Install dev dependencies
uv sync --extra dev
# Lint
uv run ruff check .
# Tests
uv run pytest -qtwitter_cli/
├── cli.py # Command-line interface
├── client.py # HTTP client + anti-detection
├── graphql.py # GraphQL query IDs, URL building
├── parser.py # Tweet/User/Media parsing
├── auth.py # Cookie extraction
├── config.py # Configuration loading
├── filter.py # Ranking/scoring logic
├── formatter.py # Rich table formatting
├── output.py # JSON/YAML serialization
└── models.py # Data models (Tweet, User, Media)# Search AI tweets from today, rank by engagement, export as JSON
twitter search "AI" --since 2026-05-17 --filter --max 20 --json > ai_digest.jsonimport subprocess
import yaml
from collections import Counter
result = subprocess.run(
["twitter", "bookmarks", "--max", "200", "--yaml"],
capture_output=True, text=True, check=True
)
data = yaml.safe_load(result.stdout)
# Extract hashtags
hashtags = []
for tweet in data["tweets"]:
hashtags.extend([h["text"] for h in tweet.get("hashtags", [])])
print(Counter(hashtags).most_common(10))import subprocess
# Generate chart, then post with image
subprocess.run(["python", "generate_chart.py"], check=True)
subprocess.run([
"twitter", "post",
"Daily metrics update",
"-i", "chart.png",
"--json"
], check=True)#!/bin/bash
# Cron job: check user tweets for keyword
tweets=$(twitter user-posts elonmusk --max 5 --yaml)
if echo "$tweets" | grep -q "Mars"; then
echo "Alert: New Mars tweet from @elonmusk"
fi