1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "region": "US",
12 "enableBusinessSearch": true,
13 "searchTasks": [
14 {
15 "keyword": "plumbers",
16 "location": "New York, NY",
17 "maxResults": 10
18 },
19 {
20 "keyword": "roofing contractors",
21 "location": "Los Angeles, CA",
22 "maxResults": 10
23 }
24 ],
25 "searchMaxResults": 10,
26 "searchSort": "relevance",
27 "searchAccreditedOnly": false,
28 "searchFetchFullDetails": false,
29 "discoverWebsiteEmails": true,
30 "enableBusinessDetails": false,
31 "profileUrls": [
32 "https://www.bbb.org/us/ny/new-york/profile/plumber/daniels-plumbing-services-0121-87144493"
33 ],
34 "enableReviewsComplaints": false,
35 "reviewsMaxItems": 10,
36 "enableScrapeByUrl": false,
37 "scrapeUrls": [
38 "https://www.bbb.org/search?find_country=USA&find_loc=New+York%2C+NY&find_text=plumbers"
39 ],
40 "webhookFormat": "json",
41 "proxyConfiguration": {
42 "useApifyProxy": true,
43 "apifyProxyGroups": [
44 "RESIDENTIAL"
45 ],
46 "apifyProxyCountry": "US"
47 }
48};
49
50
51const run = await client.actor("b2b_leads/bbb-real-time-data-scraper").call(input);
52
53
54console.log('Results from dataset');
55console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
56const { items } = await client.dataset(run.defaultDatasetId).listItems();
57items.forEach((item) => {
58 console.dir(item);
59});
60
61