Skip to content

Instantly share code, notes, and snippets.

@quantumproxies
Created July 28, 2026 09:47
Show Gist options
  • Select an option

  • Save quantumproxies/c158c983a61fd0e7f6b6f634851135f0 to your computer and use it in GitHub Desktop.

Select an option

Save quantumproxies/c158c983a61fd0e7f6b6f634851135f0 to your computer and use it in GitHub Desktop.
Monitor any webpage for content changes, cron-friendly, no false positives from ads — https://quantumproxies.io/extract-api
# Watch any webpage for content changes (pricing pages, docs, ToS, competitors).
# Extracts CONTENT as markdown before hashing, so ads/timestamps/session junk
# don't cause false positives like raw-HTML diffing does.
#
# Extraction: https://quantumproxies.io/extract-api (key: app.quantumproxies.io/api-keys)
#
# QP_API_KEY=qp_live_... python page-change-monitor.py https://example.com/pricing
# (cron it hourly; exit code 1 = page changed, so `&& notify` just works)
import hashlib, json, os, pathlib, sys
import requests
URL = sys.argv[1] if len(sys.argv) > 1 else "https://example.com"
STATE = pathlib.Path(".page-monitor.json")
r = requests.post(
"https://app.quantumproxies.io/api/v1/scraper/extract",
headers={"Authorization": f"Bearer {os.environ['QP_API_KEY']}"},
json={"url": URL, "format": "markdown"},
timeout=120,
)
r.raise_for_status()
content = r.json()["content"]
digest = hashlib.sha256(content.encode()).hexdigest()
state = json.loads(STATE.read_text()) if STATE.exists() else {}
old = state.get(URL)
state[URL] = digest
STATE.write_text(json.dumps(state, indent=2))
if old is None:
print(f"baseline stored for {URL}")
elif old == digest:
print("unchanged")
else:
print(f"CHANGED: {URL}")
sys.exit(1) # non-zero so cron/CI can trigger an alert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment