Untitled
unknown
javascript
3 years ago
769 B
5
Indexable
const request = require('request');
const cheerio = require('cheerio');
const url = '';
const selector = '.font-1rem';
let previousText = 'Current Bid : 1.50';
function checkForChanges() {
request(url, (error, response, html) => {
if (!error && response.statusCode == 200) {
const $ = cheerio.load(html);
const currentText = $(selector).text();
if (currentText !== previousText) {
console.log(`Text value has changed from "${previousText}" to "${currentText}"`);
previousText = currentText;
// Stop the interval
clearInterval(intervalId);
} else {
console.log('Text value has not changed');
}
}
});
}
const intervalId = setInterval(checkForChanges, 10000);
Editor is loading...