← back to Commercialrealestate
fix: condo fetchStatus referenced loop-scoped reg from outer closure -> captured 0; pass reg as param (matches SFR fetchRegion pattern)
eb3ad191ee0b7c784249eca7264125021cc7fbdc · 2026-07-07 07:42:03 -0700 · Steve Abrams
Files touched
M scripts/fetch-condos-redfin.js
Diff
commit eb3ad191ee0b7c784249eca7264125021cc7fbdc
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue Jul 7 07:42:03 2026 -0700
fix: condo fetchStatus referenced loop-scoped reg from outer closure -> captured 0; pass reg as param (matches SFR fetchRegion pattern)
---
scripts/fetch-condos-redfin.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/fetch-condos-redfin.js b/scripts/fetch-condos-redfin.js
index d4d506d..b2ac926 100644
--- a/scripts/fetch-condos-redfin.js
+++ b/scripts/fetch-condos-redfin.js
@@ -172,7 +172,7 @@ function condosFromCSV(text, regionName) {
await page.waitForTimeout(2500);
// status=9 active for-sale; status=130 pending/contingent (in escrow). Sweep both.
- const fetchStatus = async (status) => {
+ const fetchStatus = async (reg, status) => {
const u = `https://www.redfin.com/stingray/api/gis-csv?al=1®ion_id=${reg.region_id}®ion_type=${reg.region_type}&uipt=3&num_homes=350&status=${status}&sf=1,2,3,5,6,7&v=8`;
try {
const res = await page.evaluate(async (uu) => { const r = await fetch(uu, { headers: { accept: 'text/csv' } }); return { status: r.status, text: await r.text() }; }, u);
@@ -181,9 +181,9 @@ function condosFromCSV(text, regionName) {
};
for (const reg of group) {
const before = captured.size;
- const active = await fetchStatus(9);
+ const active = await fetchStatus(reg, 9);
await page.waitForTimeout(250);
- let pend = []; try { pend = await fetchStatus(130); } catch (_) {}
+ let pend = []; try { pend = await fetchStatus(reg, 130); } catch (_) {}
const condos = active.concat(pend);
if (condos.length) {
for (const c of condos) if (!captured.has(c.id)) captured.set(c.id, c);
← a31904e listings: real DAYS ON MARKET (gap-immune Just Listed) + In
·
back to Commercialrealestate
·
snapshots: escrow + DOM coverage (sfr 3860 escrow/13079 dom, 27c5ece →