add some more makelaars, and some more infra

This commit is contained in:
2026-04-03 15:49:42 +02:00
parent 26d9d936f4
commit 17b35d1997
9 changed files with 928 additions and 70 deletions

View File

@@ -106,11 +106,87 @@ def fetch_bjornd() -> list[RawListing]:
log.info("bjornd: %d koopwoningen opgehaald", len(listings))
return listings
# ---------------------------------------------------------------------------
# Ooms
# ---------------------------------------------------------------------------
_OOMS_BASE = "https://ooms.com"
_OOMS_CITIES = {"Delft", "Schiedam", "Rotterdam", "Leiden", "Voorburg", "Pijnacker"}
_OOMS_SKIP_STATUS = {"verhuurd", "verhuurd onder voorbehoud"}
_OOMS_STATUS_MAP = {
"beschikbaar": "beschikbaar",
"onder bod": "onder_bod",
"onder optie": "onder_bod",
"verkocht": "verkocht",
"verkocht onder voorbehoud":"verkocht",
}
def fetch_ooms() -> list[RawListing]:
data = fetch_json(f"{_OOMS_BASE}/api/properties/available.json")
listings = []
for item in data.get("objects", []):
if item.get("buy_or_rent") != "buy":
continue
if item.get("place") not in _OOMS_CITIES:
continue
if item.get("buy_price", 0) > config.MAX_PRICE:
continue
status_raw = item.get("availability_status", "")
if status_raw in _OOMS_SKIP_STATUS:
continue
hnr = item.get("house_number", "")
add = item.get("house_number_addition") or ""
adres = f"{item.get('street_name', '')} {hnr}{(' ' + add) if add else ''}".strip()
main_images = item.get("realworks_main_images") or item.get("realworks_images") or []
hero = None
if main_images:
sizes = main_images[0].get("sizes") or []
best = max(sizes, key=lambda s: s.get("width", 0), default=None)
if best:
hero = _OOMS_BASE + best["imageUrl"]
perceel = item.get("parcel_surface") or None
if perceel == 0:
perceel = None
listings.append(RawListing(
url=item["url"],
source_makelaar="ooms",
datum_aanmelding=item.get("publish_date", "")[:10] or None,
status=_OOMS_STATUS_MAP.get(status_raw, "beschikbaar"),
adres=adres or None,
postcode=(item.get("zip_code") or "").replace(" ", "") or None,
stad=item.get("place") or None,
prijs=item.get("buy_price") or None,
woningtype=item.get("appartment_characteristic") or item.get("residential_building_type") or None,
woonoppervlak=item.get("usable_area_living_function") or None,
perceeloppervlak=perceel,
kamers=item.get("amount_of_rooms") or None,
slaapkamers=item.get("amount_of_bedrooms") or None,
hero_image_url=hero,
extra={
"office": item.get("office", {}).get("name"),
"locations": item.get("locations"),
"garden_types": item.get("garden_types"),
"lat": item.get("lat"),
"lng": item.get("lng"),
"object_code": item.get("object_code"),
},
))
log.info("ooms: %d listings opgehaald", len(listings))
return listings
# ---------------------------------------------------------------------------
# SCRAPERS — exporteer hier alle actieve API adapters
# ---------------------------------------------------------------------------
SCRAPERS = {
'bjornd': fetch_bjornd,
'ooms': fetch_ooms,
}