Skip to content

Latest commit

 

History

History
79 lines (57 loc) · 2.36 KB

File metadata and controls

79 lines (57 loc) · 2.36 KB

Funda.nl Scraper — JavaScript (apify-client) examples

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

Install

npm install apify-client

Scrape a city and read listings

import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('logiover/funda-scraper').call({
  area: 'amsterdam',
  dealType: 'koop',
  maxResults: 500,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const l of items) {
  console.log(l.address, l.price, `${l.livingArea ?? '?'} m²`, l.energyLabel ?? '');
}

Price-per-m² analytics

const run = await client.actor('logiover/funda-scraper').call({
  searchUrls: ['https://www.funda.nl/zoeken/koop?selected_area=%5B%22rotterdam%22%5D'],
  maxResults: 1000,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();

const withPpm2 = items
  .filter((l) => l.price && l.livingArea)
  .map((l) => ({ address: l.address, price: l.price, ppm2: Math.round(l.price / l.livingArea) }));

const avg = Math.round(withPpm2.reduce((s, r) => s + r.ppm2, 0) / withPpm2.length);
console.log(`avg €/m² = ${avg} across ${withPpm2.length} listings`);

Build a makelaar (estate-agent) lead list

const run = await client.actor('logiover/funda-scraper').call({
  searchUrls: ['https://www.funda.nl/zoeken/huur?selected_area=%5B%22utrecht%22%5D'],
  listingType: 'huur',
  maxResults: 800,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();

const agents = new Map();
for (const l of items) {
  if (l.brokerId && !agents.has(l.brokerId)) {
    agents.set(l.brokerId, { makelaar: l.makelaar, url: l.makelaarUrl, association: l.brokerAssociation });
  }
}
console.log(`${agents.size} unique makelaars`);

Export to Excel

import { writeFileSync } from 'node:fs';

const buffer = await client.dataset(run.defaultDatasetId).downloadItems('xlsx');
writeFileSync('funda-listings.xlsx', buffer);

Docs: apify-client JS

More: README · CLI · API / cURL · Python