A Python-based tool that monitors the Hacker News homepage for a specific search string (in titles and comments) and sends alerts to a Telegram chat when matches are found. The tool uses SQLite to store previous matches, so no duplicate alerts are sent. It runs periodically and can be deployed in a Docker container.
- Python 3.7+
- Telegram Bot Token (see BotFather)
requests
andpython-telegram-bot
Python packages
- Clone the Repository
git clone https://github.com/your-repo/hackernews-scraper.git
cd hackernews-scraper
- Set Up a Virtual Environment
python3 -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
- Pip Install
pip install python-telegram-bot requests
- Create
config.json
{
"telegram_bot_token": "your_telegram_bot_token_here",
"telegram_chat_id": "your_telegram_chat_id_here",
"search_string": "your_search_string_here",
"sleep_time": 600
}
- Run
python3 main.py
docker build -t hackernews-scraper .
docker run -d -v $(pwd)/config.json:/app/config.json hackernews-scraper