mborsetti / webchanges

webchanges anonymously checks web content (including images) and commands for changes, delivering instant notifications and AI-powered summaries to your favorite platform.
https://pypi.org/project/webchanges/
Other
37 stars 6 forks source link

[BUG] saved snapshots not effective, job cycles #43

Closed ghost closed 2 years ago

ghost commented 2 years ago

Describe the bug Not sure a bug but maybe a clarification is needed on functionality...

I have a job that for some reason gets triggered over and over after an initial change.

--- #### RealVNC.com - working 4/10/22 ####
name: 04_RealVNC Server
url: "https://www.realvnc.com/en/connect/download/vnc/macos/"
filter:
  - xpath:
      path: '(//a[contains(@href,"MacOSX-x86_64.pkg")])'
  - html2text:
      method: html2text
additions_only: true
compared_versions: 2

The notifications are via email and they show that the href link has changed. This rotates between two states on every call after the initial change:

https://downloads.realvnc.com/download/file/vnc.files/VNC-Server-6.10.1-MacOSX-x86_64.pkg https://downloads.realvnc.com/download/file/vnc.files/VNC-Server-6.10.0-MacOSX-x86_64.pkg https://downloads.realvnc.com/download/file/vnc.files/VNC-Server-6.10.1-MacOSX-x86_64.pkg ...

Version info

Additional context Calling webchanges with --max-snapshots 2 versus the default of 4 doesn't seem to have any effect Adding compared_versions: 2 to the job doesn't seem to have any effect (initially was not set, set to troubleshoot) Adding additions_only: true to the job doesn't seem to have any effect

Questions Once --max_snapshots is set is it permanent? If not, may we set --max_snaphots in the .config.yaml file for all jobs?

I'd be happy to add any additional info

mborsetti commented 2 years ago

Sorry for the delay and thanks for the complete report!

If the website changes (due to misconfiguration or whatever), then webchanges is quite literally doing its job in notifying you!

However, if you don't want to be notified of certain changes, I suggest you use filters (e.g. re.sub or delete_lines_containing) to modify or delete the thing that changes on the website which you're not interested in being notified about. In this case, you can replace VNC-Server-6.10.0-MacOSX-x86_64.pkg with VNC-Server-6.11.0-MacOSX-x86_64.pkg so after filtering both states look the same, but when 6.11.1 (or whatever) comes out you will be notified.

As to the context:

As to the question:

Once --max_snapshots is set is it permanent? If not, may we set --max_snaphots in the .config.yaml file for all jobs?

No, it's not saved/not permanent; I see the value of adding it to config.yaml, so thanks for the tip!

(Issue left open to look into compared_versions and add max_snapshots to config.yaml )

mborsetti commented 2 years ago

Release 3.11 is out.

It fixes compared_versions (thanks for the report!) and adds max_snapshots to the configuration files (config.yaml) (thanks for the suggestion)!!