1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "productsA": [
12 {
13 "id": "A1",
14 "title": "Sony WH-1000XM5 Wireless Noise Cancelling Headphones, Black",
15 "brand": "Sony",
16 "price": 349.99,
17 "url": "https://shop-a.example/p/sony-wh1000xm5"
18 },
19 {
20 "id": "A2",
21 "title": "Apple iPhone 15 128GB Black",
22 "brand": "Apple",
23 "price": 799,
24 "url": "https://shop-a.example/p/iphone-15-128-black"
25 },
26 {
27 "id": "A3",
28 "title": "Samsung Galaxy S24 Ultra 256GB Titanium Gray",
29 "brand": "Samsung",
30 "price": 1299.99,
31 "url": "https://shop-a.example/p/s24-ultra-256"
32 },
33 {
34 "id": "A4",
35 "title": "Coca-Cola Original Taste 6 x 330ml cans",
36 "brand": "Coca-Cola",
37 "price": 4.99,
38 "url": "https://shop-a.example/p/coke-6x330"
39 },
40 {
41 "id": "A5",
42 "title": "L'Oréal Paris Revitalift Laser X3 Day Cream 50ml",
43 "brand": "L'Oréal Paris",
44 "price": 24.9,
45 "gtin": "3600523257461",
46 "url": "https://shop-a.example/p/revitalift-laser"
47 },
48 {
49 "id": "A6",
50 "title": "Nike Air Force 1 '07 Men's Shoes White Size 42",
51 "brand": "Nike",
52 "price": 110,
53 "url": "https://shop-a.example/p/af1-white-42"
54 }
55 ],
56 "productsB": [
57 {
58 "id": "B1",
59 "title": "SONY WH1000XM5 Noise-Cancelling Bluetooth Headphones (Black)",
60 "price": 329,
61 "url": "https://shop-b.example/item/1"
62 },
63 {
64 "id": "B2",
65 "title": "iPhone 15 256 GB - Black - Apple",
66 "price": 899,
67 "url": "https://shop-b.example/item/2"
68 },
69 {
70 "id": "B3",
71 "title": "Apple iPhone 15 (128 GB) – Black",
72 "price": 779,
73 "url": "https://shop-b.example/item/3"
74 },
75 {
76 "id": "B4",
77 "title": "Samsung Galaxy S24 Ultra 256 Go Gris Titane",
78 "price": 1249,
79 "url": "https://shop-b.example/item/4"
80 },
81 {
82 "id": "B5",
83 "title": "Coca-Cola Original 330 ml can",
84 "price": 0.99,
85 "url": "https://shop-b.example/item/5"
86 },
87 {
88 "id": "B6",
89 "title": "L'Oreal Revitalift Laser X3 Anti-Ageing Day Cream 50 ml",
90 "price": 21.99,
91 "gtin": "03600523257461",
92 "url": "https://shop-b.example/item/6"
93 }
94 ]
95};
96
97
98const run = await client.actor("freecamp008/product-matcher").call(input);
99
100
101console.log('Results from dataset');
102console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
103const { items } = await client.dataset(run.defaultDatasetId).listItems();
104items.forEach((item) => {
105 console.dir(item);
106});
107
108