Scrappy Website Change Detection: A Linux Script for Bypassing IP Blocks
Share this article
For developers and sysadmins, monitoring websites for changes is a common task—whether tracking product releases, appointment slots, or security updates. But when commercial services like changedetection.io or Visualping get blocked by aggressive IP filtering, frustration mounts. Enter a clever, open-source workaround that leverages basic Linux tools to create a lightweight, self-hosted monitor. Shared in a recent blog post, this solution capitalizes on the simplicity of ntfy for notifications and the text-based browser Links, proving that effective automation doesn't require complex infrastructure.
The Problem with Off-the-Shelf Tools
Commercial change-detection services often operate from well-known cloud IP ranges, making them easy targets for rate-limiting or blocking by websites. This can render them useless for time-sensitive scenarios, such as booking scarce government services in places like Spain. The author, constrained by the "10 minutes of productivity a newborn baby gives you," needed something quick, reliable, and unfilterable.
Building a Barebones Monitor
The core of the solution uses two tools:
- ntfy: A push notification service that supports backends like SimplePush, sending alerts directly to your phone.
- Links: A text-based web browser that dumps site content to a file, stripping away complex HTML for easy comparison.
First, ntfy is configured with a SimplePush key in ~/.config/ntfy/ntfy.yml:
backends:
- simplepush
simplepush:
key: 12345 # Replace with your actual key
Then, a bash script polls the target URL at set intervals, comparing the current and previous dumps. If changes are detected, ntfy sends a notification:
#!/usr/bin/env bash
# Initialize by removing old.txt to trigger a notification on first run
rm -f old.txt
# Set polling frequency (e.g., every 15 minutes) and target URL
POLL_FREQ_MIN=15
URL="https://example.com/"
while true; do
touch old.txt
links -dump "$URL" > new.txt
if ! diff -u old.txt new.txt > diff.txt; then
ntfy send "Check $URL" # Alert on change
fi
mv new.txt old.txt
sleep $(($POLL_FREQ_MIN * 60))
done
This script runs indefinitely, using diff to spot discrepancies. Notifications are minimal—just the URL—to avoid overwhelming a phone, but users can enhance it by piping diff.txt into the alert for context.
Why This Matters for Developers
This approach shines in its simplicity and resilience. By running on your own Linux server, it bypasses IP-based blocks that plague cloud services. It's also cost-free and privacy-focused, with no third-party intermediaries handling your data. However, it's best suited for text-heavy sites; dynamic content or JavaScript-driven pages won't render well in Links. As the author notes, it's "doable in the 10 minutes of productivity" and has proven effective for real-world use cases like securing appointments. For time-crunched engineers, it’s a reminder that sometimes the most elegant solutions emerge from constraints, turning fragmented moments into tangible wins.