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

No credit card required

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

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

cyberfly/listingwatcher
Try for free

No credit card required

Easily monitor any list of items anywhere on the web for updates and optional keywords and receive alerts (e-mail, mobile push notifications etc.) on changes of interest. Use existing watchers, easily create new ones or request new configs. Useful for any lists, listings, 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 mode

Node.js

Python

curl

1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with API token
4const client = new ApifyClient({
5    token: '<YOUR_API_TOKEN>',
6});
7
8// Prepare Actor input
9const input = {
10    "url": "https://news.ycombinator.com/news",
11    "selectors": [
12        "table table tr[class='athing'] td:nth-child(3) > span > a"
13    ],
14    "scrapers": `// (input) => ({
15        //     title: {
16        //         selectors: ["table table tr[class='athing'] td:nth-child(3) > span > a"],
17        //         extractor: node => node.innerText,
18        //     },
19        //     links: {
20        //         contents: {
21        //             selectors: ["table table tr[class='athing'] td:nth-child(3) > span > a"],
22        //             extractor: node => node.href,
23        //         },
24        //         comments: {
25        //             selectors: ["table table tr td[class='subtext'] span a[href^=item]:first-child"],
26        //             extractor: node => node.href,
27        //         },
28        //     },
29        // })`,
30    "filters": `// [
31        // 	({title}) => title.length > 1,
32        // 	({links}) => links.contents.includes('http'),
33        // ]`,
34    "proxy": {
35        "useApifyProxy": false
36    }
37};
38
39(async () => {
40    // Run the Actor and wait for it to finish
41    const run = await client.actor("cyberfly/listingwatcher").call(input);
42
43    // Fetch and print Actor results from the run's dataset (if any)
44    console.log('Results from dataset');
45    const { items } = await client.dataset(run.defaultDatasetId).listItems();
46    items.forEach((item) => {
47        console.dir(item);
48    });
49})();
Developer
Community logoMaintained by Community
Actor metrics
  • 1 monthly users
  • 91.4% runs succeeded
  • Modified 23 days ago
Categories

You might also like these Actors