fix: parse real Pararius search titles correctly

This commit is contained in:
2026-10-11 21:38:47 +00:00
parent 4ea0ba2d48
commit ecd49fc410
5 changed files with 472 additions and 17 deletions

View File

@@ -61,11 +61,13 @@ the bearer token.
## Home worker setup
Needs a machine that stays on (old laptop, Raspberry Pi, NAS) with bun.
Needs a machine that stays on (old laptop, Raspberry Pi, NAS) with Bun 1.4 or
newer; older versions cannot read this repository's lockfile. Use `bun upgrade`
if needed.
```sh
git clone https://git.stanrunge.dev/stan/personal-website ~/house-worker
cd ~/house-worker && bun install
cd ~/house-worker && bun install --frozen-lockfile
cat > house.env <<'EOF'
HOUSE_API_URL=https://stanrunge.dev
HOUSE_WORKER_TOKEN=same-value-as-the-server
@@ -130,17 +132,22 @@ red. In order:
1. Do nothing for a day. Backoff handles short blocks.
2. Slow down: raise `HOUSE_MIN_GAP_SECONDS`, lower `HOUSE_DAILY_BUDGET`, or drop
slow searches.
3. `HOUSE_FETCH_MODE=browser` uses headless Chromium with a persistent profile
(`npx playwright install chromium` once on the worker machine). Heavier, but
passes checks that plain HTTP clients don't.
3. Save a page manually in your normal browser to investigate parsing offline.
Do not switch clients, use proxies or solve challenges to bypass a block.
Commercial VPN exits are usually datacenter IPs and get challenged more, not less.
The optional `HOUSE_FETCH_MODE=browser` uses headless Chromium with a persistent
profile (`npx playwright install chromium` once on the worker machine). It obeys
the same stop/backoff rules and is not a workaround for a challenged fetch.
## Parsers
`src/lib/house-tracker/pararius.ts`, tested against trimmed real pages in
`src/lib/house-tracker/fixtures/`. Listing pages expose an exact publish
timestamp (`odp.offered_since`), coordinates, deposit, energy label and agent.
The search-page fixture is hand-written; replace it with a real saved page when
the markup is confirmed. If Pararius changes markup, the worker reports
`parse-error` in the worker log on the page.
`pararius-search-gouda.html` is a trimmed real search page saved on 2026-10-11,
with tracking and account data removed. It covers three listings, nested base
and total rent, action attributes and a lazy photo template. The synthetic
fixture still covers pagination and price on request. Rental `priceEur` is the
base/listed rent used by the search filter; a separately shown total can be
higher (Raam: €1,475 base, €1,750 total). If Pararius changes markup, the worker
reports `parse-error` in the worker log on the page.