1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "runMode": "compliant",
12 "startUrls": [
13 {
14 "url": "https://www.yellowpages.com/los-angeles-ca/dentists"
15 }
16 ],
17 "maxItems": 10,
18 "maxConcurrency": 10,
19 "maxRequestsPerMinute": 120,
20 "browserMaxConcurrency": 4,
21 "browserMaxRequestsPerMinute": 60,
22 "requestTimeoutSecs": 30,
23 "useBrowserFallback": true,
24 "maxFallbackDepth": 1,
25 "httpMaxRetries": 2,
26 "browserMaxRetries": 1,
27 "proxyConfiguration": {
28 "useApifyProxy": true,
29 "apifyProxyGroups": [
30 "RESIDENTIAL"
31 ],
32 "apifyProxyCountry": "US"
33 },
34 "extendOutputPreset": "none",
35 "failedDatasetName": "FAILED_REQUESTS",
36 "allowedHosts": [
37 "www.yellowpages.com"
38 ],
39 "maxPages": 4
40};
41
42
43const run = await client.actor("dainty_screw/advanced-yellowpages-scraper").call(input);
44
45
46console.log('Results from dataset');
47console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
48const { items } = await client.dataset(run.defaultDatasetId).listItems();
49items.forEach((item) => {
50 console.dir(item);
51});
52
53