1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "enableBusinessSearch": true,
12 "searchTerms": [
13 "plumber",
14 "roofing contractor"
15 ],
16 "searchLocations": [
17 "New York, NY"
18 ],
19 "searchMaxResults": 10,
20 "searchIncludeSponsored": false,
21 "searchFetchFullDetails": false,
22 "enrichLeadDetails": false,
23 "leadDetailsSiteLookups": 3,
24 "enableBusinessDetails": false,
25 "businessUrls": [],
26 "enableReviews": false,
27 "reviewBusinessUrls": [
28 "https://www.superpages.com/new-york-ny/bpp/handyman-at-your-service-465119325"
29 ],
30 "maxReviewsPerBusiness": 10,
31 "enableScrapeByUrl": false,
32 "scrapeUrls": [
33 "https://www.superpages.com/new-york-ny/bpp/fred-smith-plumbing-heating-460765127"
34 ],
35 "webhookFormat": "json",
36 "proxyConfiguration": {
37 "useApifyProxy": true,
38 "apifyProxyGroups": [
39 "RESIDENTIAL"
40 ],
41 "apifyProxyCountry": "US"
42 }
43};
44
45
46const run = await client.actor("b2b_leads/superpages-real-time-data-scraper").call(input);
47
48
49console.log('Results from dataset');
50console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
51const { items } = await client.dataset(run.defaultDatasetId).listItems();
52items.forEach((item) => {
53 console.dir(item);
54});
55
56