Track web pages for content changes using hash-based comparison. Supports CSS selector extraction, interval-based monitoring, change history, and configurable notification delivery.
# Compare current page with previous snapshot
python scripts/monitor.py --url https://example.com --compare state.json
# Monitor with a CSS selector
python scripts/monitor.py --url https://example.com --selector ".price" --compare state.json
python scripts/monitor.py --url URL [OPTIONS]
Options:
--url URL Page URL to monitor (required)
--selector SELECTOR CSS selector to extract specific content
--compare FILE Compare with previous snapshot from FILE
--state-file FILE Save current state to FILE (default: state.json)
--interval SEC Auto-monitor at interval (seconds)
--notify COMMAND Command to run on change detected
--json Output as JSON
--max-retries N Connection retries on failure (default: 3)
# Simple page check
python scripts/monitor.py --url https://example.com/page --compare state.json
# Monitor a price element
python scripts/monitor.py --url https://shop.example.com/product \
--selector ".product-price" --compare price-state.json
# Continuous monitoring
python scripts/monitor.py --url https://example.com \
--interval 3600 --compare state.json --notify "echo 'Changed!'"
# JSON output for pipeline
python scripts/monitor.py --url https://example.com --json
{
"url": "https://example.com/page",
"selector": ".price",
"hash": "sha256hash...",
"timestamp": "2026-01-15T14:30:00Z"
}
共 1 个版本