A CLI tool that monitors specified DOM elements on web pages and sends notifications when changes are detected.
- 🔍 Monitors any DOM element using CSS selectors
- 🔄 Supports dynamic content and SPAs
- 📱 Multiple notification methods (Desktop, Pushover, Webhook)
- 🚀 Easy to configure and use
- 🛠 Robust error handling and retry mechanism
npm install -g snift-dom-watcher- Create your personal config:
# Copy default config
cp config/snift.config.json config/local/my.config.json
# Edit your configuration
vim config/local/my.config.json- Start monitoring:
snift watch -c config/local/my.config.jsonNote: If no config file is specified, snift will use config/snift.config.json from the current directory.
url: Target webpage URLselector: CSS selector for the element to monitorinterval: Check interval (e.g., "30s", "1m", "1h")notify: Array of notification methods to use ("desktop", "pushover", "webhook")
config/snift.config.json: Default configuration fileconfig/examples/: Example configurations for different use casesconfig/local/: Directory for personal configurations (*.json files are gitignored)
Best practices:
- Start with
config/snift.config.jsonas a template - Store personal configs in
config/local/directory - Use meaningful names (e.g.,
config/local/my.config.json) - Check
config/examples/for specific use cases
- Seconds: "30s", "45s"
- Minutes: "1m", "5m", "30m"
- Hours: "1h", "2h"
- Desktop Notifications
{
"notify": ["desktop"]
}- Pushover Notifications
{
"notify": ["pushover"],
"pushover": {
"user": "YOUR_USER_KEY",
"token": "YOUR_APP_TOKEN"
}
}- Webhook
{
"notify": ["webhook"],
"webhook": {
"url": "https://your-webhook-url.com",
"method": "POST",
"headers": {
"Content-Type": "application/json"
}
}
}retryOnError: Automatically retry on errors when set totrue
Test your notification settings:
snift testYou can find example configurations in the config/examples/ directory. For instance, monitor Apple Store refurbished products:
{
"url": "https://www.apple.com/shop/product/G1CF2LL/A/",
"selector": "li.rf-dude-quote-delivery-message",
"notify": ["desktop", "pushover"],
"interval": "1m",
"retryOnError": true
}This example monitors the availability status of a specific refurbished product on the Apple Store. You'll receive notifications when the status changes (e.g., from "Out of stock" to "Available").
# Start watching with default config (config/snift.config.json)
snift watch
# Start watching with custom config
snift watch -c config/local/my.config.json
# Test notifications
snift test
# Show help
snift --help- Element not found
- Verify the selector using browser dev tools
- Check if the content is dynamically loaded
- Try increasing the check interval
- No notifications
- Check notification settings in config
- Run
snift testto verify notification setup - Check system notification settings
- High CPU/Memory usage
- Increase the check interval
- Avoid monitoring rapidly changing elements
- Consider using webhook notifications for better performance
MIT