1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "rows": [
12 {
13 "id": "demo-product-0",
14 "url": "https://example.com/products/0",
15 "title": "红色棉质短袖 M",
16 "price": "¥12.5-15.0/件",
17 "supplierId": "demo-supplier-0",
18 "demo": true
19 },
20 {
21 "id": "demo-product-1",
22 "url": "https://example.com/products/1",
23 "title": "蓝色不锈钢水杯 500ml",
24 "price": "≥100件 ¥9.8",
25 "supplierId": "demo-supplier-1",
26 "demo": true
27 },
28 {
29 "id": "demo-product-2",
30 "url": "https://example.com/products/2",
31 "title": "黑色塑料收纳箱 L",
32 "price": "¥80/箱",
33 "supplierId": "demo-supplier-2",
34 "demo": true
35 },
36 {
37 "id": "demo-product-3",
38 "url": "https://example.com/products/3",
39 "title": "红色棉质短袖 M",
40 "price": "¥0/个",
41 "supplierId": "demo-supplier-3",
42 "demo": true
43 },
44 {
45 "id": "demo-product-4",
46 "url": "https://example.com/products/4",
47 "title": "蓝色不锈钢水杯 500ml",
48 "price": "¥25/套",
49 "supplierId": "demo-supplier-0",
50 "demo": true
51 },
52 {
53 "id": "demo-product-5",
54 "url": "https://example.com/products/5",
55 "title": "黑色塑料收纳箱 L",
56 "price": "¥4.5/kg",
57 "supplierId": "demo-supplier-1",
58 "demo": true
59 },
60 {
61 "id": "demo-product-6",
62 "url": "https://example.com/products/6",
63 "title": "红色棉质短袖 M",
64 "price": "¥12.5-15.0/件",
65 "supplierId": "demo-supplier-2",
66 "demo": true
67 },
68 {
69 "id": "demo-product-7",
70 "url": "https://example.com/products/7",
71 "title": "蓝色不锈钢水杯 500ml",
72 "price": "≥100件 ¥9.8",
73 "supplierId": "demo-supplier-3",
74 "demo": true
75 },
76 {
77 "id": "demo-product-8",
78 "url": "https://example.com/products/8",
79 "title": "黑色塑料收纳箱 L",
80 "price": "¥80/箱",
81 "supplierId": "demo-supplier-0",
82 "demo": true
83 },
84 {
85 "id": "demo-product-9",
86 "url": "https://example.com/products/9",
87 "title": "红色棉质短袖 M",
88 "price": "¥0/个",
89 "supplierId": "demo-supplier-1",
90 "demo": true
91 },
92 {
93 "id": "demo-product-10",
94 "url": "https://example.com/products/10",
95 "title": "蓝色不锈钢水杯 500ml",
96 "price": "¥25/套",
97 "supplierId": "demo-supplier-2",
98 "demo": true
99 },
100 {
101 "id": "demo-product-11",
102 "url": "https://example.com/products/11",
103 "title": "黑色塑料收纳箱 L",
104 "price": "¥4.5/kg",
105 "supplierId": "demo-supplier-3",
106 "demo": true
107 },
108 {
109 "id": "demo-product-12",
110 "url": "https://example.com/products/12",
111 "title": "红色棉质短袖 M",
112 "price": "¥12.5-15.0/件",
113 "supplierId": "demo-supplier-0",
114 "demo": true
115 },
116 {
117 "id": "demo-product-13",
118 "url": "https://example.com/products/13",
119 "title": "蓝色不锈钢水杯 500ml",
120 "price": "≥100件 ¥9.8",
121 "supplierId": "demo-supplier-1",
122 "demo": true
123 },
124 {
125 "id": "demo-product-14",
126 "url": "https://example.com/products/14",
127 "title": "黑色塑料收纳箱 L",
128 "price": "¥80/箱",
129 "supplierId": "demo-supplier-2",
130 "demo": true
131 },
132 {
133 "id": "demo-product-15",
134 "url": "https://example.com/products/15",
135 "title": "红色棉质短袖 M",
136 "price": "¥0/个",
137 "supplierId": "demo-supplier-3",
138 "demo": true
139 },
140 {
141 "id": "demo-product-16",
142 "url": "https://example.com/products/16",
143 "title": "蓝色不锈钢水杯 500ml",
144 "price": "¥25/套",
145 "supplierId": "demo-supplier-0",
146 "demo": true
147 },
148 {
149 "id": "demo-product-17",
150 "url": "https://example.com/products/17",
151 "title": "黑色塑料收纳箱 L",
152 "price": "¥4.5/kg",
153 "supplierId": "demo-supplier-1",
154 "demo": true
155 },
156 {
157 "id": "demo-product-18",
158 "url": "https://example.com/products/18",
159 "title": "红色棉质短袖 M",
160 "price": "¥12.5-15.0/件",
161 "supplierId": "demo-supplier-2",
162 "demo": true
163 },
164 {
165 "id": "demo-product-19",
166 "url": "https://example.com/products/19",
167 "title": "蓝色不锈钢水杯 500ml",
168 "price": "≥100件 ¥9.8",
169 "supplierId": "demo-supplier-3",
170 "demo": true
171 },
172 {
173 "id": "demo-product-20",
174 "url": "https://example.com/products/20",
175 "title": "黑色塑料收纳箱 L",
176 "price": "¥80/箱",
177 "supplierId": "demo-supplier-0",
178 "demo": true
179 },
180 {
181 "id": "demo-product-21",
182 "url": "https://example.com/products/21",
183 "title": "红色棉质短袖 M",
184 "price": "¥0/个",
185 "supplierId": "demo-supplier-1",
186 "demo": true
187 },
188 {
189 "id": "demo-product-22",
190 "url": "https://example.com/products/22",
191 "title": "蓝色不锈钢水杯 500ml",
192 "price": "¥25/套",
193 "supplierId": "demo-supplier-2",
194 "demo": true
195 },
196 {
197 "id": "demo-product-23",
198 "url": "https://example.com/products/23",
199 "title": "黑色塑料收纳箱 L",
200 "price": "¥4.5/kg",
201 "supplierId": "demo-supplier-3",
202 "demo": true
203 },
204 {
205 "id": "demo-product-24",
206 "url": "https://example.com/products/24",
207 "title": "红色棉质短袖 M",
208 "price": "¥12.5-15.0/件",
209 "supplierId": "demo-supplier-0",
210 "demo": true
211 },
212 {
213 "id": "demo-product-25",
214 "url": "https://example.com/products/25",
215 "title": "蓝色不锈钢水杯 500ml",
216 "price": "≥100件 ¥9.8",
217 "supplierId": "demo-supplier-1",
218 "demo": true
219 },
220 {
221 "id": "demo-product-26",
222 "url": "https://example.com/products/26",
223 "title": "黑色塑料收纳箱 L",
224 "price": "¥80/箱",
225 "supplierId": "demo-supplier-2",
226 "demo": true
227 },
228 {
229 "id": "demo-product-27",
230 "url": "https://example.com/products/27",
231 "title": "红色棉质短袖 M",
232 "price": "¥0/个",
233 "supplierId": "demo-supplier-3",
234 "demo": true
235 },
236 {
237 "id": "demo-product-28",
238 "url": "https://example.com/products/28",
239 "title": "蓝色不锈钢水杯 500ml",
240 "price": "¥25/套",
241 "supplierId": "demo-supplier-0",
242 "demo": true
243 },
244 {
245 "id": "demo-product-0",
246 "url": "https://example.com/products/0",
247 "title": "黑色塑料收纳箱 L",
248 "price": "¥4.5/kg",
249 "supplierId": "demo-supplier-1",
250 "demo": true
251 }
252 ],
253 "fieldMap": {},
254 "targetCurrencies": [
255 "USD",
256 "EUR"
257 ],
258 "deduplicate": true,
259 "includePinyin": true,
260 "includeTraditional": true,
261 "maxItems": 30
262};
263
264
265const run = await client.actor("zinin/1688-taobao-product-dataset-normalizer").call(input);
266
267
268console.log('Results from dataset');
269console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
270const { items } = await client.dataset(run.defaultDatasetId).listItems();
271items.forEach((item) => {
272 console.dir(item);
273});
274
275