Pull tweets from an X (Twitter) list, convert to Markdown, and automatically check for significant war developments using the Inception Labs Mercury AI model.
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txtCreate a .env file in the directory above the project root one directory so your .env file isn't caught up in a git push.
INCEPTION_API_KEY=your_inception_labs_api_key
Grab your X auth cookies by running:
python x_grab_cookies.pyThe script will prompt you for two cookie values. To find them:
- Go to x.com in your browser and make sure you're logged in
- Press F12 to open Developer Tools
- Click the Application tab (Chrome/Edge) or Storage tab (Firefox)
- In the left sidebar, expand Cookies and click
https://x.com - Find
auth_tokenin the list and copy its Value - Find
ct0in the list and copy its Value - Paste each value when the script prompts you
Note: currently the id is my public OSINT list on X. You are fine to use that.
Edit config.json:
{
"list_id": "YOUR_LIST_ID",
"tweet_count": 70,
"scrape_media": false
}list_id— The numeric X list ID. You can find this in the URL when viewing a list on x.com (e.g.https://x.com/i/lists/1672634236292169729). Change this to pull from any public list — an OSINT list, a news list, a tech list, etc.tweet_count— Number of tweets to pullscrape_media— Set totrueto include photo/video URLs
Double-click run_pipeline.bat or run:
python run_pipeline.pyThis runs three steps in order, stopping if any step fails:
- Scrape — Pulls tweets from the X list to
list_tweets.json - Convert — Creates a timestamped Markdown file in
markdown_output/ - Check — Sends the Markdown to the Mercury API to flag significant developments
python x_list_scraper.py # Scrape tweets to JSON
python x_to_markdown.py # Convert JSON to Markdown
python check_significant.py # Check for significant developmentsrun_pipeline.bat is a Windows batch file that:
- Navigates to the project directory
- Activates the virtual environment
- Runs the full pipeline
- Stays open until you press a key
You can place a shortcut to run_pipeline.bat on your desktop or pin it to the taskbar for quick access.
The AI check (defined in prompts/prompt.txt) flags these events:
- US military casualties
- US plane shot down
- US ship hit or sunk
- Major terrorist attack in Europe or the USA
- US troops entering Iran (not just discussion/plans)
- Iran surrenders
These criteria are defined in prompts/prompt.txt and can be freely edited without touching any code. The prompt uses a {tweets} placeholder that gets replaced with the tweet content at runtime. You could repurpose this for entirely different use cases — tracking stock-moving news, monitoring for natural disasters, flagging mentions of specific companies, etc. Just rewrite the prompt to match what you're looking for.
The significance check uses Inception Labs' Mercury model, a diffusion-based language model. Unlike traditional autoregressive models that generate one token at a time, Mercury generates all tokens in parallel through an iterative denoising process, making it significantly faster at inference. The API follows the OpenAI chat completions format, so check_significant.py can be adapted to use virtually any model or provider (OpenAI, Anthropic, Ollama, etc.) by changing the endpoint URL, auth header, and model name.
This tool uses twikit, an unofficial/reverse-engineered X (Twitter) client library. It is not authorized by X's official API program and operates in a legal and policy grey area. Using twikit may violate X's Terms of Service, and excessive or automated use could result in your account being rate-limited, temporarily locked, or permanently suspended. Use this tool at your own risk, keep request volumes low, and be aware that X could take action against accounts that engage in unofficial scraping.
| File | Purpose |
|---|---|
run_pipeline.bat |
One-click Windows launcher |
run_pipeline.py |
Runs all three steps in sequence |
x_grab_cookies.py |
Save auth cookies from browser DevTools |
x_list_scraper.py |
Pull tweets from an X list |
x_to_markdown.py |
Convert JSON output to Markdown |
check_significant.py |
Check tweets for significant developments via AI |
prompts/prompt.txt |
Editable prompt template for the AI check |
config.json |
Scraper settings |
.env |
API keys (not committed) |
x_cookies.json |
Saved session cookies (not committed) |