Is there a way to check if a web page changes using the command line? Something like this:
$ check-for-changes https://bbc.co.uk/web-page
https://bbc.co.uk/web-page just changed
Using a headless browser or some other mechanism?
Is there a way to check if a web page changes using the command line? Something like this:
$ check-for-changes https://bbc.co.uk/web-page
https://bbc.co.uk/web-page just changed
Using a headless browser or some other mechanism?
First, get a fingerprint for the current state as a baseline:
curl --silent www.example.com | md5sum > www.example.com.md5
Then, you can subsequently check to see if the fingerprint changes:
curl --silent www.example.com | md5sum > www.example.com.md5new
if ! cmp www.example.com.md5 www.example.com.md5new > /dev/null; then
printf "%s has changed from baseline!\n" "www.example.com"
fi
rm www.example.com.md5new
! cmp -s www.example.com.md5 www.example.com.md5new if you don't need the actual diff.
The site may serve pages with a LAST-MODIFIED header: do a HEAD request and extract that header.
curl --silent --head https://glennj.github.io | grep -i '^last-modified:'
Not all sites return that header though.
Date response header, but not last-modified. The page is dynamically generated, so the 'Date` is always the time of request. I guess I would need to know when the html changes.