1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "mode": "search",
12 "product_name": "wireless mouse",
13 "max_results_per_site": 3,
14 "sites": [
15 "amazon",
16 "walmart",
17 "bestbuy"
18 ],
19 "proxy": {
20 "useApifyProxy": true
21 },
22 "timeout": 30,
23 "use_fast_mode": false,
24 "include_shipping": true,
25 "enable_alerts": false,
26 "alert_threshold_percentage": 5,
27 "alert_on_all_time_low": true,
28 "send_test_notification": false
29};
30
31
32const run = await client.actor("credible_sandal/price-comparison-scraper").call(input);
33
34
35console.log('Results from dataset');
36console.log(`πΎ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
37const { items } = await client.dataset(run.defaultDatasetId).listItems();
38items.forEach((item) => {
39 console.dir(item);
40});
41
42