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 "title": "Sony WH-1000XM5 Wireless Noise Cancelling Headphones",
14 "description": "Over-ear Bluetooth headphones with active noise cancellation",
15 "tags": [
16 "audio",
17 "wireless",
18 "bluetooth"
19 ]
20 },
21 {
22 "title": "KitchenAid 5-Quart Stand Mixer",
23 "description": "Countertop mixer for baking with dough hook and whisk attachments",
24 "tags": [
25 "kitchen",
26 "baking"
27 ]
28 },
29 {
30 "title": "Nike Air Zoom Pegasus Running Shoes",
31 "description": "Men's lightweight running shoes with breathable mesh upper",
32 "tags": [
33 "footwear",
34 "running"
35 ]
36 }
37 ],
38 "taxonomy": [
39 "Electronics > Audio > Headphones",
40 "Electronics > Audio > Speakers",
41 "Home & Kitchen > Small Appliances > Mixers",
42 "Home & Kitchen > Small Appliances > Blenders",
43 "Clothing & Shoes > Footwear > Running Shoes",
44 "Clothing & Shoes > Footwear > Boots"
45 ]
46};
47
48
49const run = await client.actor("that_red_bird/product-taxonomy-classifier").call(input);
50
51
52console.log('Results from dataset');
53console.log(`๐พ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
54const { items } = await client.dataset(run.defaultDatasetId).listItems();
55items.forEach((item) => {
56 console.dir(item);
57});
58
59