Skip to content

Latest commit

 

History

History
61 lines (45 loc) · 1.76 KB

File metadata and controls

61 lines (45 loc) · 1.76 KB

Allabolag Scraper — Python (apify-client) examples

Call the hosted Actor logiover/allabolag-scraper from Python with the official apify-client. Documentation only — the Actor runs on Apify.

Install

pip install apify-client

Scrape an industry and read companies

from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("logiover/allabolag-scraper").call(run_input={
    "query": "marketing",
    "maxResults": 300,
    "sort": "revenueDesc",
})

for c in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"{c['companyName']} ({c.get('orgNumber')}) — rev {c.get('revenue', 'n/a')} kSEK — {c.get('ceoName', '')}")

Build a B2B lead list (companies with an email)

run = client.actor("logiover/allabolag-scraper").call(run_input={
    "query": "restaurang",
    "maxResults": 1000,
})

leads = []
for c in client.dataset(run["defaultDatasetId"]).iterate_items():
    if c.get("email"):
        leads.append({
            "company": c["companyName"],
            "org_number": c.get("orgNumber"),
            "ceo": c.get("ceoName"),
            "email": c["email"],
            "phone": c.get("phone"),
            "city": c.get("city"),
            "revenue_kSEK": c.get("revenue"),
        })

print(f"{len(leads)} leads with email")

Export to Excel

with open("companies.xlsx", "wb") as f:
    f.write(client.dataset(run["defaultDatasetId"]).download_items(item_format="xlsx"))

Docs: apify-client Python

More: README · CLI · API / cURL · JavaScript