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": "Lovely dinner, the duck was perfect and the staff were warm. We will come back.",
14 "rating": 5,
15 "placeName": "Sample Bistro",
16 "category": "Restaurant"
17 },
18 {
19 "text": "Food was good but we waited 50 minutes for our mains and nobody apologized.",
20 "rating": 3,
21 "placeName": "Sample Bistro",
22 "category": "Restaurant"
23 },
24 {
25 "text": "Overpriced for tiny portions. Our table next to the door was freezing.",
26 "rating": 2,
27 "placeName": "Sample Bistro",
28 "category": "Restaurant"
29 },
30 {
31 "text": "Found a hair in my salad and the waiter just shrugged. Never again.",
32 "rating": 1,
33 "placeName": "Sample Bistro",
34 "category": "Restaurant"
35 },
36 {
37 "text": "Great wine list and a cozy atmosphere, a bit noisy on Friday night.",
38 "rating": 4,
39 "placeName": "Sample Bistro",
40 "category": "Restaurant"
41 }
42 ],
43 "businessType": "auto",
44 "maxReviews": 500,
45 "maxReviewsPerPlace": 100
46};
47
48
49const run = await client.actor("sherwood/review-analyzer").call(input);
50
51
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