Minimal twikit-based CLI for exporting a small batch of tweets from your X timeline.
Dependencies and Python are pinned in pyproject.toml and uv.lock.
uv sync
cp .env.example .envFill .env with your account credentials. Runtime cookies are saved to .cache/twikit/cookies.json by default and are ignored by git.
To bypass the password login flow, set TWIKIT_COOKIE_ONLY=true and point TWIKIT_COOKIES_FILE to an existing JSON cookies file. The file can be Twikit's saved cookie object or a browser-exported JSON list with name/value entries.
Fetch the default Following timeline as readable text:
uv run xreader --count 20Fetch For You and output JSON Lines:
uv run xreader --timeline for-you --format jsonl --count 20Required environment variables unless TWIKIT_COOKIE_ONLY=true:
TWIKIT_USERNAMETWIKIT_PASSWORD
Optional environment variables:
TWIKIT_EMAILTWIKIT_TOTP_SECRETTWIKIT_COOKIE_ONLYdefaults tofalse; settrueto skip password login and load cookies directlyTWIKIT_COOKIES_FILEdefaults to.cache/twikit/cookies.jsonTWIKIT_LANGUAGEdefaults toen-USTWIKIT_IMPERSONATEoptional browser TLS fingerprint for Cloudflare/X 403s, e.g.chrome124TWIKIT_ENABLE_UI_METRICSdefaults totrue; setfalseif login fails while solving Xui_metricsJavaScript
uv run python -m unittest discover -s tests