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 "category": "roofing",
15 "location": "Austin, TX",
16 "maxResults": 10
17 },
18 {
19 "category": "plumbing",
20 "location": "Dallas, TX",
21 "maxResults": 10
22 }
23 ],
24 "maxPagesPerTask": 5,
25 "enableSimpleSearch": false,
26 "maxResultsPerTask": 10,
27 "enableLeadDetails": true,
28 "maxItems": 10000,
29 "concurrency": 4,
30 "delayBetweenRequestsMs": 1200,
31 "proxyConfiguration": {
32 "useApifyProxy": true,
33 "apifyProxyGroups": [
34 "RESIDENTIAL"
35 ],
36 "apifyProxyCountry": "US"
37 }
38};
39
40
41const run = await client.actor("b2b_leads/homeadvisor-real-time-data-scraper").call(input);
42
43
44console.log('Results from dataset');
45console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
46const { items } = await client.dataset(run.defaultDatasetId).listItems();
47items.forEach((item) => {
48 console.dir(item);
49});
50
51