Call Website Contact Scraper from Python with the official apify-client. This is client-side only — you call the Actor on the Apify platform and read back the results.
pip install apify-clientGet your token from Apify Console → Settings → Integrations. Prefer an environment variable over hard-coding it.
import os
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"]) # or ApifyClient("YOUR_TOKEN")import os
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
# Realistic input: scan homepages + Contact/About pages
run_input = {
"startUrls": [
{"url": "https://apify.com"},
{"url": "https://www.stripe.com"},
{"url": "https://www.example-agency.com"},
],
"maxDepth": 1,
"maxRequestsPerCrawl": 40,
"useJsBrowser": False,
"proxyConfiguration": {"useApifyProxy": True},
}
# Start the run and wait for it to finish
run = client.actor("logiover/website-contact-scraper").call(run_input=run_input)
# Iterate results (one item per page)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print({
"domain": item.get("rootDomain"),
"pageType": item.get("pageType"),
"emails": item.get("emails"),
"phones": item.get("phones"),
"linkedin": item.get("socials", {}).get("linkedin"),
"instagram": item.get("socials", {}).get("instagram"),
"title": item.get("pageTitle"),
})Call with no input to run the small demo crawl and preview the output:
run = client.actor("logiover/website-contact-scraper").call()
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item)Keep only companies with an email or LinkedIn URL, then flatten to rows:
leads = []
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
emails = item.get("emails") or []
phones = item.get("phones") or []
socials = item.get("socials") or {}
if emails or socials.get("linkedin"):
leads.append({
"domain": item.get("rootDomain"),
"email": emails[0] if emails else "",
"phone": phones[0] if phones else "",
"linkedin": socials.get("linkedin", ""),
"instagram": socials.get("instagram", ""),
"company": item.get("pageTitle", ""),
"source": item.get("url"),
})
print(f"Qualified {len(leads)} leads")Write the qualified leads straight to a CSV file for import into a CRM or sequencer:
import csv
with open("contacts.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(
f,
fieldnames=["domain", "email", "phone", "linkedin", "instagram", "company", "source"],
)
writer.writeheader()
writer.writerows(leads)| Field | Type | Default | Notes |
|---|---|---|---|
startUrls |
list of { "url": ... } |
demo crawl | Websites to scrape. |
maxDepth |
int 0–1 |
1 |
0 = homepage only; 1 = also Contact/About pages. |
maxRequestsPerCrawl |
int | 200 |
Page budget per run. |
useJsBrowser |
bool | False |
Enable only for JS-rendered sites returning empty pages. |
proxyConfiguration |
dict | {"useApifyProxy": True} |
Apify Proxy settings. |