A
A
ansido2021-10-26 20:03:42
Monitoring
ansido, 2021-10-26 20:03:42

How to monitor the fact that a web page has changed?

Task: to track the fact of changing a web page like https://www.fonbet.ru/sports/chess/
To begin with, it is a fact, and not what has changed there.

I know that there are ready-made solutions that work well for me with other sites.
The problem is that none of the out-of-the-box tools I've tried (distill.io, visualping) work properly with the content of this page.

My cumbersome solution: a python script that regularly takes partial browser screenshots of this page (where there are no blinking banners). If the next screenshot differs from the previous one, a notification is sent.
Since this requires a page to be always open on the screen, this is all done in a virtual OS.

Question: Is there an easier way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GrayHorse, 2021-10-27
@GrayHorse

Task: track the fact that a web page has changed

MutationObserver
const targetNode = document.querySelector("body");
const config = {attributes: true, childList: true, subtree: true};

function callback(mutationsList, observer) {
    console.log("Что-то изменилось", mutationsList);
}

const observer = new MutationObserver(callback);
observer.observe(targetNode, config);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question