Content & Listings Monitor
No credit card required
Content & Listings Monitor
No credit card required
Monitor anything, anywhere. Receive mobile alerts or execute actions on updates of interest. Useful for listings, news, articles, products and more.
You can access the Content & Listings Monitor programmatically from your own JavaScript applications by using the Apify API. You can also choose the language preference from below. To use the Apify API, youβll need an Apify account and your API token, found in Integrations settings in Apify Console.
1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4// Replace the '<YOUR_API_TOKEN>' with your token
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9// Prepare Actor input
10const input = {
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 // ({price}, {price: oldPrice}) => price < oldPrice,
34 // ]`,
35 "matcher": `// E.g. exclude dynamic "price":
36 // ({price, ...match}) => match`,
37 "pages.retries": 3,
38 "hooks.load": `// async page => {
39 // await page.click('button[name="cookie-consent"]').catch(error => null);
40 // }`,
41 "alerts.limit": 10,
42 "limits.alerts": 10,
43 "limits.results": 100,
44 "proxy": {
45 "useApifyProxy": false
46 }
47};
48
49// Run the Actor and wait for it to finish
50const run = await client.actor("cyberfly/listingmonitor").call(input);
51
52// Fetch and print Actor results from the run's dataset (if any)
53console.log('Results from dataset');
54console.log(`πΎ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
55const { items } = await client.dataset(run.defaultDatasetId).listItems();
56items.forEach((item) => {
57 console.dir(item);
58});
59
60// π Want to learn more π? Go to β https://docs.apify.com/api/client/js/docs
Content & Listings Monitor API in JavaScript
The Apify API client for JavaScript is the official library that allows you to use Content & Listings Monitor API in JavaScript or TypeScript, providing convenience functions and automatic retries on errors.
Install the apify-client
npm install apify-client
Other API clients include:
Actor Metrics
4 monthly users
-
2 stars
93% runs succeeded
Created in Jan 2024
Modified 2 days ago