Creating session tokens - zedeus/nitter GitHub Wiki

Warning

Running a large public instance is difficult, and is not feasible with a small amount of accounts. If you'd like to run one, consider reaching out to @zedeus:nolog.chat (Matrix) or [email protected] (email) for assistance with getting started.

Nitter requires real accounts to authenticate API requests. The sessions are loaded from sessions.jsonl in the directory where the nitter binary is. You can overwrite this by setting the environment variable NITTER_SESSIONS_FILE.

JSONL, aka NDJSON, is the only supported format. The filename must end in .jsonl. The file should look like this:

{"oauth_token": "...", "oauth_token_secret": "..."}
{"oauth_token": "...", "oauth_token_secret": "..."}
{"oauth_token": "...", "oauth_token_secret": "..."}

To create a session, you can use the get_session.py script in this repo. Note that this script assumes the account has 2FA enabled, which is strongly recommended.

# assuming you're in the root nitter folder
cd tools
python3 -m venv venv && source venv/bin/activate # optional
pip install pyotp requests
python get_session.py <username> <password> <2fa secret> ../sessions.jsonl

You can now run Nitter, and you should see the following:

[sessions] Parsing JSONL account sessions file: ./sessions.jsonl
[sessions] Successfully added 1 valid account sessions.

If you have more than one account, you can run the script again, though it's recommended to run this through a proxy/VPN if you're planning to create many sessions.

⚠️ **GitHub.com Fallback** ⚠️