1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "enableSearch": true,
12 "searchTasks": [
13 {
14 "trade": "Plumber",
15 "location": "Bristol",
16 "maxResults": 10
17 },
18 {
19 "trade": "Electrician",
20 "location": "London",
21 "maxResults": 10
22 }
23 ],
24 "maxResultsPerTask": 10,
25 "maxPagesPerTask": 5,
26 "enableProfileDetails": true,
27 "maxReviewsPerProfile": 3,
28 "enableContactDiscovery": false,
29 "maxItems": 10000,
30 "concurrency": 4,
31 "delayBetweenRequestsMs": 1200,
32 "proxyConfiguration": {
33 "useApifyProxy": true,
34 "apifyProxyGroups": [
35 "RESIDENTIAL"
36 ],
37 "apifyProxyCountry": "GB"
38 }
39};
40
41
42const run = await client.actor("b2b_leads/checkatrade-real-time-data-scraper").call(input);
43
44
45console.log('Results from dataset');
46console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
47const { items } = await client.dataset(run.defaultDatasetId).listItems();
48items.forEach((item) => {
49 console.dir(item);
50});
51
52