1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "categoryOrProductUrls": [
12 {
13 "url": "https://www.amazon.com/s?k=keyboard"
14 }
15 ],
16 "maxItemsPerStartUrl": 100,
17 "proxyCountry": "AUTO_SELECT_PROXY_COUNTRY",
18 "maxSearchPagesPerStartUrl": 9999,
19 "maxProductVariantsAsSeparateResults": 0,
20 "maxOffers": 0,
21 "locationDeliverableRoutes": [
22 "PRODUCT",
23 "SEARCH",
24 "OFFERS"
25 ]
26};
27
28
29const run = await client.actor("junglee/amazon-crawler").call(input);
30
31
32console.log('Results from dataset');
33console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
34const { items } = await client.dataset(run.defaultDatasetId).listItems();
35items.forEach((item) => {
36 console.dir(item);
37});
38
39