A Python application that monitors website registration pages and sends Telegram notifications when registration status changes.
- Monitors multiple URLs for registration availability
- Sends real-time alerts via Telegram
- Comprehensive error handling and logging
- Configurable check intervals
- Headless Chrome browser automation
This application has been completely refactored with the following improvements:
- Removed hardcoded credentials - Now uses environment variables
- Added
.env.exampletemplate for secure configuration
- Object-oriented design - Introduced
TelegramNotifierandWebsiteMonitorclasses - Proper error handling - Try-except blocks with specific exception handling
- Context managers - File operations use
withstatements - Type hints - Added for better code clarity
- Logging - Comprehensive logging to file and console
- Clean imports - Removed duplicates and unused imports
- Fixed scheduler logic - Removed broken scheduler implementation
- Simplified main loop - Clear, maintainable monitoring loop
- Configurable settings - Environment-based configuration
- Graceful shutdown - Proper cleanup on exit
- Python 3.7+
- Chrome/Chromium browser
- ChromeDriver (matching your Chrome version)
- Install dependencies:
pip install -r requirements.txt- Copy the example environment file:
cp .env.example .env- Edit
.envand add your credentials:- Get a Telegram bot token from @BotFather
- Get your chat ID by messaging your bot and visiting:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
Edit your .env file:
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here
CHECK_INTERVAL=30 # Check every 30 seconds
SEARCH_STRING=нитЕ # String to search forRun the monitor:
python streamlit_app.pyTo load the .env file automatically, you can:
- Use python-dotenv in the code (add
from dotenv import load_dotenv; load_dotenv()at the top) - Or export variables manually:
export $(cat .env | xargs)
python streamlit_app.py- The monitor checks specified URLs at regular intervals
- It searches for a specific string on each page
- When the string is found: Registration is likely CLOSED
- When the string is not found: Registration may be OPEN
- Telegram alerts are sent for each check result
- Console output shows real-time monitoring status
monitor.logfile contains detailed logs- All errors and alerts are logged
Press Ctrl+C to gracefully stop the monitor. It will clean up temporary files before exiting.
- Never commit your
.envfile - It contains sensitive credentials - Keep your Telegram bot token secret
- The
.env.examplefile is safe to commit (contains no real credentials)
This is a monitoring tool for personal use. Ensure you have permission to monitor any websites you configure.