1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "products": [
12 {
13 "id": "EXAMPLE-RICE",
14 "title": "Example basmati rice 1.5kg",
15 "price": 4.5,
16 "unitPrice": "£3.50/kg",
17 "market": "UK"
18 },
19 {
20 "id": "EXAMPLE-COLA",
21 "title": "Example cola 6 x 330ml",
22 "price": "€3.96",
23 "unitPrice": "€2.00 / l",
24 "market": "FR"
25 },
26 {
27 "id": "EXAMPLE-COFFEE",
28 "title": "Example ground coffee 500 g",
29 "price": "5,99 €",
30 "unitPrice": "1,20 € / 100 g",
31 "market": "DE"
32 },
33 {
34 "id": "EXAMPLE-CEREAL",
35 "title": "Example corn flakes 500g",
36 "price": 2,
37 "regularPrice": 3,
38 "unitPrice": "£6.00/kg",
39 "market": "UK"
40 },
41 {
42 "id": "EXAMPLE-WATER",
43 "title": "Example sparkling water, 12 pack 12 fl oz cans",
44 "price": 5.49,
45 "market": "US"
46 }
47 ]
48};
49
50
51const run = await client.actor("ultimatemc/unit-price-checker").call(input);
52
53
54console.log('Results from dataset');
55console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
56const { items } = await client.dataset(run.defaultDatasetId).listItems();
57items.forEach((item) => {
58 console.dir(item);
59});
60
61