1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "country": "US",
12 "enableBusinessSearch": true,
13 "searchTasks": [
14 {
15 "keyword": "plumber",
16 "location": "Brooklyn, NY 11223"
17 }
18 ],
19 "searchKeywords": [],
20 "searchLocation": "Brooklyn, NY 11223",
21 "searchMaxResults": 10,
22 "searchFetchLeadDetails": false,
23 "discoverEmails": false,
24 "enableBusinessDetails": false,
25 "businessUrls": [],
26 "enableReviews": false,
27 "reviewBusinessUrls": [],
28 "reviewsMaxPerBusiness": 20,
29 "enableScrapeByUrl": false,
30 "scrapeUrls": [
31 "https://www.merchantcircle.com/search?q=plumber&qn=Brooklyn%2C+NY+11223"
32 ],
33 "webhookFormat": "json",
34 "proxyConfiguration": {
35 "useApifyProxy": true,
36 "apifyProxyGroups": [
37 "RESIDENTIAL"
38 ],
39 "apifyProxyCountry": "US"
40 }
41};
42
43
44const run = await client.actor("b2b_leads/merchantcircle-real-time-data-scraper").call(input);
45
46
47console.log('Results from dataset');
48console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
49const { items } = await client.dataset(run.defaultDatasetId).listItems();
50items.forEach((item) => {
51 console.dir(item);
52});
53
54