1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "currentItems": [
12 {
13 "id": "h1",
14 "title": "Hotel Alpha",
15 "rating": 4.6,
16 "reviewCount": 8200,
17 "complaintRate": 9,
18 "velocityPct": 41,
19 "competitorGap": 18
20 },
21 {
22 "id": "h2",
23 "title": "Hotel Beta",
24 "rating": 3.7,
25 "reviewCount": 6400,
26 "complaintRate": 37,
27 "velocityPct": 18,
28 "competitorGap": -12
29 }
30 ],
31 "previousItems": [
32 {
33 "id": "h1",
34 "title": "Hotel Alpha",
35 "rating": 4.3,
36 "reviewCount": 6900,
37 "complaintRate": 14,
38 "velocityPct": 29,
39 "competitorGap": 9
40 }
41 ]
42};
43
44
45const run = await client.actor("quanmatrix/tripadvisor-reputation-gap-intelligence").call(input);
46
47
48console.log('Results from dataset');
49console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
50const { items } = await client.dataset(run.defaultDatasetId).listItems();
51items.forEach((item) => {
52 console.dir(item);
53});
54
55