Skip to content

Latest commit

 

History

History
52 lines (39 loc) · 1.31 KB

README.md

File metadata and controls

52 lines (39 loc) · 1.31 KB

Hacker News Scraper with Telegram Alerts

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.

Requirements

  • Python 3.7+
  • Telegram Bot Token (see BotFather)
  • requests and python-telegram-bot Python packages

Installation

  1. Clone the Repository
 git clone https://github.com/your-repo/hackernews-scraper.git
 cd hackernews-scraper
  1. Set Up a Virtual Environment
python3 -m venv venv
source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
  1. Pip Install
pip install python-telegram-bot requests
  1. 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
  }
  1. Run
  python3 main.py

Optionally run with docker

  docker build -t hackernews-scraper .
  docker run -d -v $(pwd)/config.json:/app/config.json hackernews-scraper