Listings Monitor
No credit card required
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 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 "limits.alerts": 10,
42 "limits.results": 100,
43 "proxy": {
44 "useApifyProxy": false
45 }
46};
47
48// Run the Actor and wait for it to finish
49const run = await client.actor("cyberfly/listingmonitor").call(input);
50
51// Fetch and print Actor results from the run's dataset (if any)
52console.log('Results from dataset');
53console.log(`πΎ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
54const { items } = await client.dataset(run.defaultDatasetId).listItems();
55items.forEach((item) => {
56 console.dir(item);
57});
58
59// π Want to learn more π? Go to β https://docs.apify.com/api/client/js/docs
Listings Monitor API in JavaScript
The Apify API client for JavaScript is the official library that allows you to use 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
3 monthly users
-
2 stars
>99% runs succeeded
Created in Jan 2024
Modified 11 hours ago