1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "region": "US",
10 "enableBusinessSearch": True,
11 "searchTasks": [
12 {
13 "keyword": "plumbers",
14 "location": "New York, NY",
15 "maxResults": 10,
16 },
17 {
18 "keyword": "roofing contractors",
19 "location": "Los Angeles, CA",
20 "maxResults": 10,
21 },
22 ],
23 "searchMaxResults": 10,
24 "searchSort": "relevance",
25 "searchAccreditedOnly": False,
26 "searchFetchFullDetails": False,
27 "discoverWebsiteEmails": True,
28 "enableBusinessDetails": False,
29 "profileUrls": ["https://www.bbb.org/us/ny/new-york/profile/plumber/daniels-plumbing-services-0121-87144493"],
30 "enableReviewsComplaints": False,
31 "reviewsMaxItems": 10,
32 "enableScrapeByUrl": False,
33 "scrapeUrls": ["https://www.bbb.org/search?find_country=USA&find_loc=New+York%2C+NY&find_text=plumbers"],
34 "webhookFormat": "json",
35 "proxyConfiguration": {
36 "useApifyProxy": True,
37 "apifyProxyGroups": ["RESIDENTIAL"],
38 "apifyProxyCountry": "US",
39 },
40}
41
42
43run = client.actor("b2b_leads/bbb-real-time-data-scraper").call(run_input=run_input)
44
45
46print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
47for item in client.dataset(run.default_dataset_id).iterate_items():
48 print(item)
49
50