Actor picture

Content Checker

jakubbalada/content-checker

Monitor a website or web page for content changes. Automatically saves before and after screenshots and sends an email notification when content changes are detected.

No credit card required

Author's avatarJakub Balada
  • Modified
  • Users1,438
  • Runs3,980,406

To run the code examples, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token. For a more detailed explanation, please read about running actors via the API in Apify Docs.

import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with API token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare actor input
const input = {
    "url": "https://www.apify.com/change-log",
    "contentSelector": "[class^=change-log__MonthBox-]:nth-of-type(1) ul",
    "screenshotSelector": "[class^=change-log__MonthBox-]:nth-of-type(1) ul",
    "sendNotificationText": "Apify found a new change!",
    "proxy": {
        "useApifyProxy": false
    },
    "navigationTimeout": 30000
};

(async () => {
    // Run the actor and wait for it to finish
    const run = await client.actor("jakubbalada/content-checker").call(input);

    // Fetch and print actor results from the run's dataset (if any)
    console.log('Results from dataset');
    const { items } = await client.dataset(run.defaultDatasetId).listItems();
    items.forEach((item) => {
        console.dir(item);
    });
})();