WatchHTML is a Go-based utility designed to track changes in the HTML of a given webpage. It operates like a cron job, periodically checking the webpage and storing an initial snapshot of the HTML elements specified by an XPath. On subsequent checks, it compares the current HTML to the stored snapshot. If a change is detected, a notification is sent to a specified Slack channel through a webhook.
These instructions will guide you through getting a copy of the project and running it on your local machine for development and testing purposes.
You will need Go installed on your machine. For instructions on how to install Go, please refer to the official Go documentation.
If you'd prefer not to install Go and run the application directly, you can use the provided Docker image:
docker pull ruzmuh/watchhtml
Once the image is pulled, you can run the tool using Docker. Remember to provide necessary environment variables/flags and mount the state store.
- Clone the repository into your workspace:
git clone https://github.com/ruzmuh/watchhtml.git
- Navigate to the cloned repository:
cd watchhtml
- Compile and install the package:
go install
The tool is run as a standalone task, akin to a cron job:
watchhtml --url <url> --xpath <xpath> --slackwebhook <webhook> --storedir <dir>
You can also use environment variables prefixed with WATCHHTML_
in place of flags.
--slackwebhook string
/WATCHHTML_SLACKWEBHOOK
: Slack webhook URL for notifications.--storedir string
/WATCHHTML_STOREDIR
: Directory for storing HTML snapshots. By default, this is the current directory ("./"
).--url string
/WATCHHTML_URL
: URL of the webpage to track for changes.--xpath string
/WATCHHTML_XPATH
: XPath of the HTML elements to track on the webpage.--extramessage string
/WATCHHTML_EXTRAMESSAGE
: extra message content. e.g mention user
Note: The --version
and --help
flags do not have corresponding environment variables.
--version
: Prints the version of the tool and exits.--help
: Displays usage information.
To check the version of the tool, use the --version
flag:
watchhtml --version