I'm trying to write a script that notifies me when a static web page has changed. To do it, I'm using wget
to download the web page, and diff
to check whether it has changed or not. I'm running an Ubuntu 20.04 LTS virtual machine. Here is the example:
$ wget --quiet https://twiki.di.uniroma1.it/twiki/view/Reti_Avanzate/InternetOfThings2021 -O file1
$ wget --quiet https://twiki.di.uniroma1.it/twiki/view/Reti_Avanzate/InternetOfThings2021 -O file2
$ diff -q file1 file2
Files file1 and file2 differ
As you can see, diff
reports differences between the two files. Why? Even if I try to compare them with diff -y
they look the same for me.
UPDATE
Looking for differences with git diff --color-words -- file1 file2
gave the following result:
Apparently, there's a field in which the timestamp is added, and in one of the two files there's a <!--GENERATED_HEADERS-->
which is absent in the other.
Any idea on how to solve it?
git diff --color-words -- file1 file2
might be more illustrative than a line-based view.<a href="/twiki/..." class="twikiLink">
, and thehref
andclass
attributes are in the opposite order in another between two downloads I got. You could use some tool to just extract the text content (but whitespace might still be a problem). Or, since it looks to be a wiki with version control, look at the revision number/date. It says "Topic revision: r170 - 2021-05-22" at the bottom of the page.