metaodi / website-monitor

A simple monitor script for any change on a website
MIT License
0 stars 1 forks source link

website-monitor

GitHub Action to monitor a list of websites

This repository contains CSVs in the csv directory, which are used to define a list of websites to monitor. The files is parsed on a regular basis (see the workflow file for details) and a notification is sent via Telegram if a change has been detected.

CSV format

The CSV must have the following structure:

label,active,error_count,url,selector,type,hash

Example:

label active error_count url selector type hash
"Thalwil informiert" yes 0 https://www.thalwil.ch/aktuellesinformationen #informationList static db60b21849b715eb4c12d75f285d460de6dfbc17b9429f8f0bfcc78fca76cb2e

Script to watch for changes in website (monitor.py)

A small script to monitor the contents of a website and get a notification if there are changes.

Installation

  1. Clone this repository
  2. Run the setup.sh script.sh or install manually the dependencies:
source env/bin/activate
pip install -r requirements.py

Usage

$ python monitor.py --help
Usage:
  monitor.py --url <url-of-website> [--selector <css-selector>] [--wait <number-of-seconds>] [--verbose] [--no-verify]
  monitor.py (-h | --help)
  monitor.py --version
Options:
  -h, --help                     Show this screen.
  --version                      Show version.
  -u, --url <url-of-website>     URL of the website to monitor.
  -s, --selector <css-selector>  CSS selector to check for changes [default: body].
  -w, --wait <number-of-seconds> Number of seconds to wait until the URL is checked again [default: 30].
  --verbose                      Option to enable more verbose output.
  --no-verify                    Option to disable SSL verification for requests.

Examples

Watch «Amtliche Sammlung» of the City of Zurich:

python monitor.py --url https://www.stadt-zuerich.ch/portal/de/index/politik_u_recht/amtliche_sammlung.html --selector .mod_newsteaser

Ignore SSL certificate errors:

python monitor.py --url https://metaodi.ch --selector div.content --no-verify

Verbose output:

python monitor.py -u https://www.wikidata.org/wiki/Special:Random --selector span.wikibase-title-label --verbose

Check every 5 seconds:

python monitor.py -u https://www.wikidata.org/wiki/Special:Random --selector span.wikibase-title-label --wait 5