Scraping tweets has become increasingly difficult without paying high API fees or relying on third-party services like Nitter. However, since Nitter often imposes timeouts and access limits, this project recommend using private instance.
This Python bot scrapes tweets from Nitter, stores them in MongoDB, and sends new tweet alerts to a Telegram channel — all without using the official Twitter API.
An overview of the bot’s scraping and alert process.
- 🧩 Nitter Scraper — use your own instance.
- 💾 MongoDB Storage — Keeps track of tweet IDs to avoid duplicate alerts.
- 📢 Telegram Integration — Sends formatted tweet notifications to your Telegram channel.
- 🧠 Randomized Headers — Generates unique HTTP headers and cookies on every request to bypass scraping restrictions.
- ⚙️ Error Handling — Manages connection and parsing errors per user gracefully.
- Python 3.8+
- A MongoDB instance (local or cloud)
- A Telegram Bot API Key (from @BotFather)
Set these environment variables (or create a .env file):
API=<your_telegram_bot_api_key>
CHANNEL_ID=<your_telegram_channel_id>
MONGODB_URI=<your_mongodb_connection_uri>