1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "urls": [
12 "https://example.com/pricing",
13 "https://example.com/changelog"
14 ],
15 "watchId": "competitor-pricing",
16 "fields": {
17 "price": ".price | /([\\d.,]+)/",
18 "title": "h1",
19 "docsLink": "a.docs@href",
20 "plans": "all:.plan .name",
21 "apiVersion": "json:data.version"
22 },
23 "ignoreSelectors": [
24 ".ads",
25 "#comments",
26 "time",
27 ".view-count"
28 ],
29 "ignorePatterns": [
30 "\\d{1,2}:\\d{2}(:\\d{2})?",
31 "\\d+ (seconds|minutes|hours) ago"
32 ]
33};
34
35
36const run = await client.actor("vikingtrading/recurring-web-check").call(input);
37
38
39console.log('Results from dataset');
40console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
41const { items } = await client.dataset(run.defaultDatasetId).listItems();
42items.forEach((item) => {
43 console.dir(item);
44});
45
46