Listings Monitor - News, blogs, issues, articles, products etc. avatar
Listings Monitor - News, blogs, issues, articles, products etc.
Try for free

No credit card required

View all Actors
Listings Monitor - News, blogs, issues, articles, products etc.

Listings Monitor - News, blogs, issues, articles, products etc.

cyberfly/listingmonitor
Try for free

No credit card required

Monitor content and listings on the web using optional keywords and filters. Take actions or receive alerts (e-mail, mobile push notifications etc.) on changes of interest. Use existing configs or easily create or request new ones. Useful for things like news, jobs, articles, products etc.

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn more

1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4const client = new ApifyClient({
5    token: '<YOUR_API_TOKEN>',
6});
7
8// Prepare Actor input
9const input = {
10    "selectors": [
11        "table table tr[class='athing'] td:nth-child(3) > span > a"
12    ],
13    "scrapers": `// (input) => ({
14        //     title: {
15        //         selectors: ["table table tr[class='athing'] td:nth-child(3) > span > a"],
16        //         extractor: node => node.innerText,
17        //     },
18        //     links: {
19        //         contents: {
20        //             selectors: ["table table tr[class='athing'] td:nth-child(3) > span > a"],
21        //             extractor: node => node.href,
22        //         },
23        //         comments: {
24        //             selectors: ["table table tr td[class='subtext'] span a[href^=item]:first-child"],
25        //             extractor: node => node.href,
26        //         },
27        //     },
28        // })`,
29    "filters": `// [
30        // 	({title}) => title.length > 1,
31        // 	({links}) => links.contents.includes('http'),
32        // 	({price}, {price: oldPrice}) => price < oldPrice,
33        // ]`,
34    "matcher": `// E.g. exclude dynamic "price":
35        // ({price, ...match}) => match`,
36    "pages.retries": 3,
37    "hooks.load": `// async page => {
38        // 	await page.click('button[name="cookie-consent"]').catch(error => null);
39        // }`,
40    "limits.alerts": 10,
41    "limits.results": 100,
42    "proxy": {
43        "useApifyProxy": false
44    }
45};
46
47(async () => {
48    // Run the Actor and wait for it to finish
49    const run = await client.actor("cyberfly/listingmonitor").call(input);
50
51    // Fetch and print Actor results from the run's dataset (if any)
52    console.log('Results from dataset');
53    console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
54    const { items } = await client.dataset(run.defaultDatasetId).listItems();
55    items.forEach((item) => {
56        console.dir(item);
57    });
58})();
59
60// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Developer
Maintained by Community
Actor metrics
  • 1 monthly user
  • 2 stars
  • 100.0% runs succeeded
  • Created in Jan 2024
  • Modified 21 days ago
Categories