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 "asin": "A1",
14 "brand": "Alpha Audio",
15 "category": "Headphones",
16 "price": 24.99,
17 "currency": "USD"
18 },
19 {
20 "asin": "A2",
21 "brand": "Alpha Audio",
22 "category": "Headphones",
23 "price": 34.5,
24 "currency": "USD"
25 },
26 {
27 "asin": "A3",
28 "brand": "Alpha Audio",
29 "category": "Headphones",
30 "price": 39,
31 "currency": "USD"
32 },
33 {
34 "asin": "B1",
35 "brand": "Beta Sound",
36 "category": "Headphones",
37 "price": "$59.00",
38 "currency": "USD"
39 },
40 {
41 "asin": "B2",
42 "brand": "Beta Sound",
43 "category": "Headphones",
44 "price": "$74.90",
45 "currency": "USD"
46 },
47 {
48 "asin": "B3",
49 "brand": "Beta Sound",
50 "category": "Headphones",
51 "price": "$89.00",
52 "currency": "USD"
53 },
54 {
55 "asin": "B4",
56 "brand": "Beta Sound",
57 "category": "Headphones",
58 "price": "$129.00",
59 "currency": "USD"
60 },
61 {
62 "asin": "G1",
63 "brand": "Gamma Gear",
64 "category": "Headphones",
65 "price": "29,90 €",
66 "currency": "EUR"
67 },
68 {
69 "asin": "G2",
70 "brand": "Gamma Gear",
71 "category": "Headphones",
72 "price": "44,90 €",
73 "currency": "EUR"
74 },
75 {
76 "asin": "G3",
77 "brand": "Gamma Gear",
78 "category": "Headphones",
79 "price": "79,00 €",
80 "currency": "EUR"
81 },
82 {
83 "asin": "D1",
84 "brand": "Delta Desk",
85 "category": "Desk Lamps",
86 "price": 18,
87 "currency": "USD"
88 },
89 {
90 "asin": "D2",
91 "brand": "Delta Desk",
92 "category": "Desk Lamps",
93 "price": 27.5,
94 "currency": "USD"
95 }
96 ]
97};
98
99
100const run = await client.actor("practical_ai_lab_jp/pal-amazon-brand-price-segments").call(input);
101
102
103console.log('Results from dataset');
104console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
105const { items } = await client.dataset(run.defaultDatasetId).listItems();
106items.forEach((item) => {
107 console.dir(item);
108});
109
110