Call the hosted Redfin Scraper from Python with the official apify-client.
pip install apify-clientfrom apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("logiover/redfin-scraper").call(run_input={
"searchUrls": ["https://www.redfin.com/city/30818/TX/Austin"],
"listingType": "forSale",
"sortBy": "newest",
"minPrice": 300000,
"maxPrice": 900000,
"minBeds": 3,
"maxResults": 500,
})
for home in client.dataset(run["defaultDatasetId"]).iterate_items():
print(home["address"], home["price"], home["beds"], "bd /", home["baths"], "ba")import pandas as pd
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("logiover/redfin-scraper").call(run_input={
"searchUrls": ["90210"],
"listingType": "sold",
"sortBy": "recommended",
"maxResults": 500,
})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
df = pd.DataFrame(items)
cols = ["address", "price", "soldDate", "beds", "baths", "sqFt", "pricePerSqFt", "daysOnMarket", "mlsId"]
print(df[cols].head(20))
df.to_csv("comps_90210.csv", index=False)from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("logiover/redfin-scraper").call(run_input={
"searchUrls": ["33139"],
"listingType": "rent",
"minBeds": 2,
"maxResults": 300,
})
rentals = list(client.dataset(run["defaultDatasetId"]).iterate_items())
priced = [r for r in rentals if r.get("price")]
avg_rent = sum(r["price"] for r in priced) / len(priced)
print(f"{len(rentals)} rentals, average asking rent ${avg_rent:,.0f}")from collections import defaultdict
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("logiover/redfin-scraper").call(run_input={
"searchUrls": ["78704", "78745", "78702"],
"listingType": "forSale",
"minBeds": 3,
"maxResults": 1000,
})
by_zip = defaultdict(list)
for home in client.dataset(run["defaultDatasetId"]).iterate_items():
if home.get("pricePerSqFt"):
by_zip[home["zip"]].append(home["pricePerSqFt"])
for zip_code, ppsf in by_zip.items():
print(f"{zip_code}: {len(ppsf)} homes, avg ${sum(ppsf) / len(ppsf):,.0f}/sqft")