1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "reviews": [
12 {
13 "text": "The room was spotless and the location right by the harbor was perfect. Breakfast had great variety.",
14 "rating": 5
15 },
16 {
17 "text": "Staff at reception were friendly, but check-in took almost 40 minutes. Frustrating after a long flight.",
18 "rating": 3
19 },
20 {
21 "text": "Walls are paper thin, we heard every footstep from the corridor all night. Could not sleep.",
22 "rating": 2
23 },
24 {
25 "text": "Amazing breakfast and the pool area was clean, but the room smelled of smoke despite being non-smoking.",
26 "rating": 3
27 },
28 {
29 "text": "Best value for money in the area. Comfortable bed, hot shower, and the staff recommended great restaurants.",
30 "rating": 5
31 }
32 ]
33};
34
35
36const run = await client.actor("enezli/tripadvisor-review-intelligence").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