// Kamernet search pages (kamernet.nl/huren/huurwoningen-). The page is server-rendered // Next.js; the listings sit in the __NEXT_DATA__ JSON, so no HTML scraping is needed. // /huren/ is allowed in Kamernet's robots.txt. import { int, str, type ScrapedListing, type SearchPage } from './scraped'; import type { PropertyType } from './types'; export const KAMERNET_ORIGIN = 'https://kamernet.nl'; // listingType -> (URL word, our type). Seen on the site: 1 kamer, 2 appartement, 4 studio. const types: Record = { 1: ['kamer', 'room'], 2: ['appartement', 'apartment'], 4: ['studio', 'studio'], 8: ['anti-kraak', 'other'] }; const furnishing: Record = { 1: 'kaal', 2: 'gestoffeerd', 4: 'gemeubileerd' }; export function kamernetSearchUrl(citySlug: string, page = 1): string { const url = `${KAMERNET_ORIGIN}/huren/huurwoningen-${citySlug}`; return page > 1 ? `${url}?pageNo=${page}` : url; } type RawListing = Record; export function parseKamernetSearch(html: string): SearchPage { const match = /