Plasmate Price Tracker

April 11, 2026 ยท View on GitHub

Monitor product prices on e-commerce sites and get alerts when prices drop. Uses Plasmate to extract structured price data from any product page.

Features

  • Track products from any e-commerce site
  • Automatic price extraction using Plasmate's Semantic Object Model
  • Price history tracking with SQLite
  • Alerts via Slack, Discord, or Email
  • Flexible scheduling (cron or daemon mode)
  • Docker support for easy deployment

Quick Start

# Install dependencies
pip install -r requirements.txt

# Make sure Plasmate is installed and in PATH
plasmate --version

# Add a product to track
python tracker.py add "https://www.amazon.com/dp/B0EXAMPLE" --name "Cool Gadget"

# Check prices
python tracker.py check

# View price history
python tracker.py history "https://www.amazon.com/dp/B0EXAMPLE"

# List all tracked products
python tracker.py list

Commands

tracker.py

CommandDescription
add <url> [--name]Add a product to track
listShow all tracked products with current prices
check [--notify] [--threshold]Check all prices, show changes
history <url>Show price history for a product
remove <url>Stop tracking a product
statsShow tracking statistics

scheduler.py

CommandDescription
watch --interval 1hCheck prices every hour
run [-n count]Run immediate check(s)
daemonRun as background service
cronPrint crontab examples

Example: Tracking an Amazon Product

# Add the product
python tracker.py add "https://www.amazon.com/dp/B0D1XD1ZV3" \
    --name "Sony WH-1000XM5 Headphones"

# Check prices now
python tracker.py check

# Set up hourly monitoring
python scheduler.py watch --interval 1h

Notification Setup

Slack

  1. Create a Slack webhook: https://api.slack.com/messaging/webhooks
  2. Set environment variable:
export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/T00/B00/XXXX"

Discord

  1. Create a Discord webhook in channel settings
  2. Set environment variable:
export DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/123/abc"

Email (SMTP)

Set these environment variables:

export SMTP_HOST="smtp.gmail.com"
export SMTP_PORT="587"
export SMTP_USER="your-email@gmail.com"
export SMTP_PASS="your-app-password"
export EMAIL_TO="alerts@example.com"
export EMAIL_FROM="price-tracker@example.com"  # optional, defaults to SMTP_USER

Test Notifications

python notifier.py

Scheduling

Using the built-in watcher

# Check every hour
python scheduler.py watch --interval 1h

# Check every 30 minutes
python scheduler.py watch --interval 30m

# Check every 6 hours, skip initial check
python scheduler.py watch -i 6h --no-run-now

Using cron

# Print crontab examples
python scheduler.py cron

# Edit crontab
crontab -e

# Add line for hourly checks:
0 * * * * cd /path/to/tracker && python tracker.py check

Using Docker

# Build
docker build -t price-tracker .

# Run with hourly checks
docker run -d \
    -e PRICE_CHECK_INTERVAL=1h \
    -e SLACK_WEBHOOK_URL=https://hooks.slack.com/... \
    -v ./prices.db:/app/prices.db \
    price-tracker

How Price Extraction Works

The tracker uses Plasmate to fetch product pages and convert them to a Semantic Object Model (SOM). The extractor.py module then:

  1. Searches for elements with price-related classes (price, cost, sale, etc.)
  2. Looks for microdata attributes (itemprop="price")
  3. Matches currency patterns in text ($19.99, EUR 29, etc.)
  4. Prioritizes current/sale prices over original/list prices
  5. Filters out shipping/tax amounts

Supported formats:

  • $19.99, $1,234.56
  • 19.99 USD, EUR 29
  • Euro and Pound symbols
  • Japanese Yen (no decimals)

Troubleshooting

"Could not extract price"

The price extraction failed. This can happen if:

  • The page requires JavaScript (Plasmate handles most cases)
  • The price format isn't recognized
  • The page structure is unusual

Try running plasmate fetch <url> directly to see the SOM output.

"plasmate command not found"

Install Plasmate:

# Using cargo
cargo install plasmate

# Or from source
git clone https://github.com/user/plasmate
cd plasmate
cargo build --release

Prices seem wrong

Run plasmate fetch <url> and check the SOM JSON. The extractor looks for price-related classes - if the site uses unusual markup, you may need to adjust PRICE_CLASS_PATTERNS in extractor.py.

Data Storage

Product data is stored in prices.db (SQLite). Tables:

  • products - URLs, names, creation dates
  • price_history - Price records with timestamps

To export data:

sqlite3 prices.db ".dump" > backup.sql

License

MIT