1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "pairs": [
12 {
13 "id": "detergent-example",
14 "left": {
15 "price": "12.50",
16 "currency": "USD",
17 "packSize": "6 x 500 ml"
18 },
19 "right": {
20 "price": "4.20",
21 "currency": "USD",
22 "packSize": "1 L"
23 }
24 },
25 {
26 "id": "paper-example",
27 "left": {
28 "price": "9.00",
29 "currency": "USD",
30 "packSize": "12 pcs"
31 },
32 "right": {
33 "price": "4.50",
34 "currency": "USD",
35 "packSize": "6 pcs"
36 }
37 },
38 {
39 "id": "manual-review-example",
40 "left": {
41 "price": "5.00",
42 "currency": "USD",
43 "packSize": "12 oz"
44 },
45 "right": {
46 "price": "6.00",
47 "currency": "USD",
48 "packSize": "500 g"
49 }
50 }
51 ]
52};
53
54
55const run = await client.actor("cooing_openness/pack-price-comparator").call(input);
56
57
58console.log('Results from dataset');
59console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
60const { items } = await client.dataset(run.defaultDatasetId).listItems();
61items.forEach((item) => {
62 console.dir(item);
63});
64
65