thp / urlwatch

Watch (parts of) webpages and get notified when something changes via e-mail, on your phone or via other means. Highly configurable.
https://thp.io/2008/urlwatch/
Other
2.81k stars 352 forks source link

Show error when filters don't match anything #682

Closed knutwannheden closed 2 years ago

knutwannheden commented 2 years ago

I would like to use urlwatch to monitor a rather large set of pages. Many of these pages are expected to change every now and then (without notice) so that the urlwatch filters need to be adapted to the new page. I was therefore hoping to see an error when a filter like for example element-by-tag doesn't match anything anymore.

mborsetti commented 2 years ago

Not sure if this would help you, but the webchanges fork (optimized for HTML) has an --error command line argument you can run periodically which highlights any jobs that have no content after filters are applied.

In any case if a job used to match "ABC" but if after a change in the source website nothing is being matched anymore, you will get a change notification with the deletion of "ABC". The rationale for the --error command line argument was to be able to do periodic checks in case such a change was being missed, but probably more can be done.

thp commented 2 years ago

You can use --test-filter JOB to see if the filter still works. When creating the entry and testing the filter, usually it will have some output. If that output then changes to the empty string, because the webpage changed, you will anyway get a notification.

An empty match doesn't necessarily mean the job "fails" (urlwatch can also be used to "wait" for an element to (re-)appear).