Skip to content

Latest commit

 

History

History
87 lines (64 loc) · 2.25 KB

File metadata and controls

87 lines (64 loc) · 2.25 KB

Daft.ie Scraper — Python examples

Call the Daft.ie Scraper from Python with the official apify-client. This calls the hosted Actor.

Install

pip install apify-client

Houses for sale in Dublin

from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("logiover/daft-ie-scraper").call(run_input={
    "searchUrls": ["https://www.daft.ie/property-for-sale/dublin"],
    "maxResults": 500,
})

items = client.dataset(run["defaultDatasetId"]).list_items().items
print(f"Got {len(items)} listings")
print(items[0])

Build an estate-agent lead list

from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("logiover/daft-ie-scraper").call(run_input={
    "searchUrls": ["https://www.daft.ie/property-for-rent/dublin-city"],
    "maxResults": 1000,
})

leads = []
for l in client.dataset(run["defaultDatasetId"]).iterate_items():
    if l.get("agentPhone"):
        leads.append({
            "agent": l.get("agentName"),
            "agency": l.get("agencyName"),
            "phone": l.get("agentPhone"),
            "licence": l.get("agentLicence"),
            "listing": l.get("title"),
        })

print(f"{len(leads)} agent leads")

Price analytics with pandas

import pandas as pd
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("logiover/daft-ie-scraper").call(run_input={
    "searchUrls": ["https://www.daft.ie/property-for-sale/cork"],
    "maxResults": 2000,
})

rows = list(client.dataset(run["defaultDatasetId"]).iterate_items())
df = pd.DataFrame(rows)
df.to_csv("daft.csv", index=False)
print("Median asking price:", df["price"].dropna().median())
print(df[["title", "price", "beds", "berRating", "county"]].head())

Using the dropdowns (no URL)

run = client.actor("logiover/daft-ie-scraper").call(run_input={
    "section": "property-for-sale",
    "county": "galway",
    "propertyType": "houses",
    "maxResults": 500,
})

See also: CLI · API / cURL · JavaScript.

▶️ Run on Apify