Back to articles
How to Build a Website Change Detector in 30 Lines of Code

How to Build a Website Change Detector in 30 Lines of Code

via Dev.to JavaScriptOzor

Ever needed to know when a website updates its content? Maybe you're tracking competitor pricing, monitoring a job board, or watching for policy changes. Most solutions require Puppeteer, a headless browser, and 200+ lines of boilerplate. Here's how to do it in 30 lines with a free API. The Approach Scrape a URL to clean markdown Hash the content Compare with the previous hash Alert if changed No browser dependencies. No Selenium. Just HTTP requests. The Code import crypto from ' crypto ' ; const API = ' https://agent-gateway-kappa.vercel.app/v1/agent-scraper ' ; const WATCH_URL = ' https://example.com ' ; // Replace with your target const CHECK_INTERVAL = 60 * 60 * 1000 ; // 1 hour let previousHash = null ; async function checkForChanges () { const res = await fetch ( ` ${ API } /api/scrape?url= ${ encodeURIComponent ( WATCH_URL )} &format=markdown` ); const data = await res . json (); if ( ! data . content ) { console . error ( ' Scrape failed: ' , data . error ); return ; } const ha

Continue reading on Dev.to JavaScript

Opens in a new tab

Read Full Article
2 views

Related Articles