Skip to content

TRINITY-21/snoop

Repository files navigation

Snoop

CLI price tracker that scrapes product prices, stores history in SQLite, and sends Telegram alerts when prices drop.

Commands

Command What it does
snoop add <url> Start tracking a product (auto-detects price + name)
snoop list Show all tracked products with current prices
snoop check [id] Check prices now (all products or specific one)
snoop history <id> View price history for a product
snoop remove <id> Stop tracking a product
snoop watch Start background watcher (checks every 30 min)

Options

Flag Used with What it does
--name "..." add Custom product name
--target 49.99 add Set target price for alerts
--selector ".price" add Custom CSS selector for price element
--interval 15 watch Check interval in minutes (default: 30)
--limit 50 history Number of history entries to show

Supported Sites

Works out of the box with predefined selectors:

  • Amazon (.com, .co.uk)
  • Steam
  • eBay
  • Best Buy
  • Walmart
  • Newegg
  • Hepsiburada
  • Trendyol

For other sites, Snoop auto-detects prices using schema.org markup, JSON-LD, Open Graph tags, and common patterns. If auto-detection fails, use --selector with a CSS selector.

Alerts

Sends Telegram notifications when:

  • Price drops below your target price
  • Price drops more than 5% from last check
  • A new all-time low is recorded

Stack

  • Python 3.11+ — sync throughout
  • requests — HTTP with browser headers
  • BeautifulSoup + lxml — HTML parsing and CSS selectors
  • SQLite — local price history storage
  • APScheduler — periodic price checking in watch mode
  • Rich — formatted CLI tables and colored output
  • Telegram Bot API — price drop alerts via HTTP POST

Setup

git clone https://github.com/TRINITY-21/snoop.git
cd snoop
pip install -r requirements.txt

Create .env:

TELEGRAM_BOT_TOKEN=your_token_from_botfather
TELEGRAM_CHAT_ID=your_chat_id

Get your chat ID by messaging @userinfobot on Telegram.

Run:

python snoop.py add https://store.steampowered.com/app/1245620/ELDEN_RING/ --target 29.99
python snoop.py list
python snoop.py watch --interval 15

Architecture

snoop/
├── snoop.py        # CLI entry point (argparse + Rich tables)
├── config.py       # Loads .env, validates required keys
├── scraper.py      # Price extraction: known selectors → auto-detect → fallback
├── store.py        # SQLite: products + price_history tables
├── notifier.py     # Telegram alerts via Bot API HTTP POST
├── watcher.py      # APScheduler periodic checker
└── formatters.py   # Pure functions for CLI + Telegram output

Key design decisions:

  • Scraper and notifier are separate — scraper has no Telegram imports
  • Known sites get predefined CSS selectors; unknown sites get multi-strategy auto-detection
  • Price parser handles US ($1,234.56), European (1.234,56), and Turkish (49,99 TL) formats
  • SQLite with WAL mode for safe reads during watch mode
  • Formatters are pure functions — take data, return strings

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages