const puppeteer = require ("puppeteer"); const url = "https://crypto.2mars.biz/stats" const $ = require("cheerio").default const CronJob = require('cron').CronJob async function configureBrowser() { const browser = await puppeteer.launch({defaultViewport: null, headless: true}); const page = await browser.newPage(); await page.goto(url); return page; } async function checkBlocks(page) { await page.reload(); let html = await page.evaluate(() => document.body.innerHTML); $('#statsValidBlocksflux', html).each(function() { let amount = $(this).text(); console.log(amount) var currentamount = Number(amount.replace(amount)); if (currentamount = (currentamount + 1)) { console.log("we hit a block ==> " + currentamount) } }) } async function startTracking() { const page = await configureBrowser(); let job = new CronJob('*/30 * * * * *', function(){ checkBlocks(page); }, null, true, null, null, true); job.start } startTracking();