1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "runMode": "compliant",
10 "startUrls": [{ "url": "https://www.yellowpages.com/los-angeles-ca/dentists" }],
11 "maxItems": 10,
12 "maxConcurrency": 10,
13 "maxRequestsPerMinute": 120,
14 "browserMaxConcurrency": 4,
15 "browserMaxRequestsPerMinute": 60,
16 "requestTimeoutSecs": 30,
17 "useBrowserFallback": True,
18 "maxFallbackDepth": 1,
19 "httpMaxRetries": 2,
20 "browserMaxRetries": 1,
21 "proxyConfiguration": {
22 "useApifyProxy": True,
23 "apifyProxyGroups": ["RESIDENTIAL"],
24 "apifyProxyCountry": "US",
25 },
26 "extendOutputPreset": "none",
27 "failedDatasetName": "FAILED_REQUESTS",
28 "allowedHosts": ["www.yellowpages.com"],
29 "maxPages": 4,
30}
31
32
33run = client.actor("dainty_screw/yellowpage-scraper").call(run_input=run_input)
34
35
36print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
37for item in client.dataset(run.default_dataset_id).iterate_items():
38 print(item)
39
40