Fetch tweets, lists, articles, and WeChat content β with smart backend routing.
Three backends Β· Auto fallback Β· Works everywhere (VPS / Mac / Windows / CI / Claude Code / OpenClaw)
Quick Start Β· Backends Β· Capabilities Β· Self-hosted Nitter Β· Claude Code & CC
You: fetch that tweet / list / article for me
AI: I can't access X/Twitter. Please copy-paste the content manually.
You: ...seriously?
X has no free API. Scraping gets you blocked. Browser automation is fragile and won't work in headless environments.
x-tweet-fetcher solves this with smart backend routing: Nitter for zero-dependency speed, Playwright for full-feature coverage, auto fallback between them.
# Auto mode (default) β Nitter first, browser fallback
python3 scripts/fetch_tweet.py --user elonmusk
# Nitter only β zero dependency, no browser
python3 scripts/fetch_tweet.py --user elonmusk --backend nitter
# Browser only β full features (lists, articles)
python3 scripts/fetch_tweet.py --list 1455045069516357634 --backend browser| Backend | Deps | Speed | Features |
|---|---|---|---|
| nitter | None (stdlib only) | β‘ Fast | Timeline, search, replies, profile, mentions |
| browser | Playwright/Chromium | π’ Slower | Everything above + Lists + Articles + fetch_china |
| auto (default) | Best available | β‘βπ’ | Tries nitter first, falls back to browser |
OpenClaw users: Playwright + Chromium are built-in.
--backend autojust works β no extra install needed.
| Feature | Backend | Output |
|---|---|---|
| Single tweet | FxTwitter (always) | text, stats, media, quotes |
| Reply comments | nitter / browser | threaded comment list |
| User timeline | nitter / browser | paginated tweet list |
| @mentions monitor | nitter / browser | incremental new mentions |
| Keyword search | nitter / browser | real-time tweet stream |
| X Lists | browser only | list member tweets |
| X Articles | browser only | full long-form content |
| User profile analysis | nitter + LLM | MBTI, Big Five, topic graph |
| WeChat article search | Sogou (direct HTTP) | title, url, author, date |
| WeChat/Weibo/Bilibili | browser only | via fetch_china.py |
| Tweet growth tracker | FxTwitter API | growth curves, burst detection |
For AI Agents: All output is structured JSON. Import as Python modules for direct integration. Exit codes are cron-friendly (
0=nothing new,1=new content).
# Works immediately β no Nitter, no browser needed
python3 scripts/fetch_tweet.py --url https://x.com/elonmusk/status/123456789# Set your Nitter instance URL (for nitter/auto mode)
export NITTER_URL=http://127.0.0.1:8788
# User timeline
python3 scripts/fetch_tweet.py --user elonmusk --limit 20
# Keyword search β real-time tweets
python3 scripts/nitter_client.py --search "AI agent"
# Tweet replies
python3 scripts/fetch_tweet.py --url https://x.com/elonmusk/status/123456789 --replies
# @mentions monitoring (cron-friendly)
python3 scripts/fetch_tweet.py --monitor @yourusername
# User profile analysis
python3 scripts/x-profile-analyzer.py --user elonmusk --count 100# X List β requires Playwright
python3 scripts/fetch_tweet.py --list 1455045069516357634 --backend browser
# X Article
python3 scripts/fetch_tweet.py --article https://x.com/user/article/123 --backend browser
# WeChat / Weibo / Bilibili
python3 scripts/fetch_china.py --url "https://mp.weixin.qq.com/s/..."python3 scripts/sogou_wechat.py --keyword "AI Agent" --limit 5 --jsonSince x-tweet-fetcher has zero mandatory dependencies, it works perfectly in constrained environments:
| Environment | nitter mode | browser mode | Notes |
|---|---|---|---|
| Claude Code (CC) | β | β | No browser runtime |
| OpenClaw | β | β | Playwright built-in |
| VPS (headless Linux) | β | β * | *needs pip install playwright |
| Mac / Windows | β | β * | *needs pip install playwright |
| CI/CD pipelines | β | Possible but heavy | |
| Docker containers | β | Needs Chromium in image | |
| Termux (Android) | β | β | No Chromium |
# In Claude Code (nitter mode, zero deps):
export NITTER_URL=http://your-vps:8788
python3 scripts/fetch_tweet.py --user YuLin807 --limit 10
# In OpenClaw (auto mode, full features):
python3 scripts/fetch_tweet.py --user YuLin807 --limit 10
# β auto-detects Nitter, falls back to Playwright if needed
β οΈ Public Nitter instances are dead or unreliable (as of March 2026). Self-hosting is the only reliable option.
Twitter removed guest API access in 2023. Public Nitter instances get rate-limited because thousands of users share a few accounts. Your own instance = your own rate limits.
# Ubuntu/Debian
sudo apt install -y redis-server libpcre3-dev libsass-dev
# Install Nim
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
export PATH=$HOME/.nimble/bin:$PATHgit clone https://github.com/zedeus/nitter
cd nitter
nimble build -d:release
nimble scss
cp nitter.example.conf nitter.confUse a secondary account (not your main).
- Log into X in browser β DevTools β Application β Cookies β
x.com - Copy
auth_tokenandct0 - Create
sessions.jsonl:
{"name":"myaccount","auth_token":"YOUR_AUTH_TOKEN","ct0":"YOUR_CT0"}[Server]
address = "127.0.0.1" # Local only!
port = 8788
[Config]
hmacKey = "$(openssl rand -hex 32)"
[Tokens]
tokenFile = "sessions.jsonl"sudo systemctl start redis-server
./nitter
# Test
curl http://127.0.0.1:8788/YuLin807
export NITTER_URL=http://127.0.0.1:8788
python3 scripts/nitter_client.py --search "test"- Bind to
127.0.0.1only β never expose to public internet - Use a secondary X account β session token gives full access
- Session tokens last ~1 year
βββββββββββββββ
--url β FxTwitter β β Public API, no auth needed
β (free) β
ββββββββ¬βββββββ
β JSON
ββββββββββββββ΄βββββββββββββ
β --backend auto β
β βββββββββ ββββββββββ β ββββββββββββ
--user β βNitter ββββBrowser β β β Agent β
--replies β β(fast) β β(full) β ββββββββΆβ (JSON) β
--monitor β β 0 dep β βPlaywrt β β β β
--search β βββββββββ ββββββββββ β ββββββββββββ
--list βββββββββββββββββββββββββββ
--article
βββββββββββββββ
sogou_wechat β Sogou β β Direct HTTP, no API key
fetch_china β (search) β
βββββββββββββββ
- Single tweets: FxTwitter β always works, zero auth
- Timeline / Replies / Search / Mentions: Self-hosted Nitter or Playwright browser
- Lists / Articles: Playwright browser (Nitter doesn't support these)
- WeChat / China platforms: Sogou search + fetch_china.py
Python 3.7+ (that's it for nitter mode)
| Mode | Extra requirement |
|---|---|
--backend nitter |
Nothing (Python stdlib only) |
--backend browser |
pip install playwright + playwright install chromium |
--backend auto |
Uses whatever is available |
Exit codes for automation: 0=nothing new, 1=new content, 2=error.
# Check mentions every 30 min
*/30 * * * * NITTER_URL=http://127.0.0.1:8788 python3 fetch_tweet.py --monitor @username
# Discover tweets daily
0 9 * * * python3 nitter_client.py --search "AI Agent" >> ~/discoveries.jsonlIssues and PRs welcome! Core platforms:
- X/Twitter β Nitter + Playwright backends
- WeChat articles β Sogou search
Other platforms welcome as community PRs.
- Nitter by zedeus (12.6k β) β self-hosted Twitter frontend
- FxTwitter β public API for single tweet data
- Playwright β browser automation for full-feature coverage
- OpenClaw β AI agent framework
Three backends. Auto fallback. Works everywhere. π¦
GitHub Β· Issues Β· OpenClaw Q&A