[object Object]

← back to Commercialrealestate

auto-save: 2026-06-28T08:13:35 (2 files) — scripts/fetch-closed-sales.js data/redfin-agents.json

8e18085dbb65514dd54f084f5ea64df88aed3dd4 · 2026-06-28 08:13:42 -0700 · Steve Abrams

Files touched

Diff

commit 8e18085dbb65514dd54f084f5ea64df88aed3dd4
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sun Jun 28 08:13:42 2026 -0700

    auto-save: 2026-06-28T08:13:35 (2 files) — scripts/fetch-closed-sales.js data/redfin-agents.json
---
 data/redfin-agents.json       | 141 ++++++++++++++++++++++++++++++++++++++++++
 scripts/fetch-closed-sales.js |  10 ++-
 2 files changed, 148 insertions(+), 3 deletions(-)

diff --git a/data/redfin-agents.json b/data/redfin-agents.json
new file mode 100644
index 0000000..6527e91
--- /dev/null
+++ b/data/redfin-agents.json
@@ -0,0 +1,141 @@
+{
+  "meta": {
+    "source": "Redfin per-property detail feed (mainHouseInfoPanelInfo), via warmed Browserbase session",
+    "endpoint": "/stingray/api/home/details/mainHouseInfoPanelInfo?propertyId=<id>&accessLevel=1",
+    "sessions_used": 2,
+    "cost": "~$0.08 (2 Browserbase sessions @ $0.04)",
+    "cap": "HARD CAP 2 sessions / $0.08",
+    "label": "Business-contact only (agent name / brokerage / business phone / business email / license). Suppressed agents honestly labeled, not fabricated.",
+    "fetched_at": "2026-06-28T15:03:16.626Z",
+    "summary": {
+      "captured": 12,
+      "withPhone": 3,
+      "withEmail": 3,
+      "withLicense": 12,
+      "suppressed": 3,
+      "errors": 1
+    }
+  },
+  "results": [
+    {
+      "condo": "rdfACB370D18174",
+      "pid": "195894220",
+      "status": 403,
+      "error": "non-200"
+    },
+    {
+      "condo": "rdf41130167",
+      "pid": "174393584",
+      "agent": "Andrea Harrell-boone",
+      "brokerage": "BHG REAL ESTATE ROYAL & ASSOC.",
+      "phone": false,
+      "email": false
+    },
+    {
+      "condo": "rdf41133133",
+      "pid": "163108082",
+      "agent": "June Jardin",
+      "brokerage": "BHHS Drysdale Properties",
+      "phone": false,
+      "email": false
+    },
+    {
+      "condo": "rdf41133894",
+      "pid": "1548545",
+      "agent": "Lisa Oerlemans",
+      "brokerage": "Re/Max Gold Blue Line Group",
+      "phone": false,
+      "email": false
+    },
+    {
+      "condo": "rdf41134812",
+      "pid": "1448709",
+      "agent": "Melissa Case",
+      "brokerage": "BHG RE Reliance Partners",
+      "phone": false,
+      "email": false
+    },
+    {
+      "condo": "rdf41137294",
+      "pid": "1892979",
+      "agent": "Joe Kalajian",
+      "brokerage": "Christie's Intl RE Sereno",
+      "phone": false,
+      "email": false
+    },
+    {
+      "condo": "rdf41138312",
+      "pid": "197254955",
+      "agent": "Amy Alvarez",
+      "brokerage": "Truly Real Estate",
+      "phone": false,
+      "email": false
+    },
+    {
+      "condo": "rdf41138315",
+      "pid": "197254956",
+      "agent": "Amy Alvarez",
+      "brokerage": "Truly Real Estate",
+      "phone": false,
+      "email": false
+    },
+    {
+      "condo": "rdf41138316",
+      "pid": "197254957",
+      "agent": "Amy Alvarez",
+      "brokerage": "Truly Real Estate",
+      "phone": false,
+      "email": false
+    },
+    {
+      "condo": "rdf41138904",
+      "pid": "536903",
+      "agent": "Debra Rebhahn",
+      "brokerage": "Compass",
+      "phone": false,
+      "email": false
+    },
+    {
+      "condo": "rdf07A88D7EEF87",
+      "pid": "202315076",
+      "agent": null,
+      "label": "no public agent (Redfin-listed / suppressed)"
+    },
+    {
+      "condo": "rdf07F82E239BE9",
+      "pid": "196070908",
+      "agent": null,
+      "label": "no public agent (Redfin-listed / suppressed)"
+    },
+    {
+      "condo": "rdf116535",
+      "pid": "5265960",
+      "agent": null,
+      "label": "no public agent (Redfin-listed / suppressed)"
+    },
+    {
+      "condo": "rdf226003050",
+      "pid": "8130466",
+      "agent": "David Samuels",
+      "brokerage": "Keller Williams Westlake Village",
+      "phone": true,
+      "email": true
+    },
+    {
+      "condo": "rdf26827229",
+      "pid": "184825219",
+      "agent": "Andy Dulman",
+      "brokerage": "Compass",
+      "phone": true,
+      "email": true
+    },
+    {
+      "condo": "rdf26832437",
+      "pid": "5364113",
+      "agent": "Sheree Thiel",
+      "brokerage": "Beverly & Company Luxury Properties",
+      "phone": true,
+      "email": true
+    }
+  ]
+}
\ No newline at end of file
diff --git a/scripts/fetch-closed-sales.js b/scripts/fetch-closed-sales.js
index 402fdae..212c020 100644
--- a/scripts/fetch-closed-sales.js
+++ b/scripts/fetch-closed-sales.js
@@ -35,8 +35,12 @@ function parseCsv(text) {
     beds numeric, baths numeric, sqft int, year_built int, mls text, url text UNIQUE,
     source text DEFAULT 'redfin gis-csv (sold)', created_at timestamptz DEFAULT now())`);
 
-  const regions = JSON.parse(fs.readFileSync(path.join(ROOT, 'data', 'redfin-regions.json'), 'utf8')).resolved || [];
-  const work = (MAXR ? regions.slice(0, MAXR) : regions).filter(r => r.region_id);
+  // Region list = resolved city regions (type 6) + neighborhood regions (type 1), from both resolver files.
+  const load = (f, type) => { try { return (JSON.parse(fs.readFileSync(path.join(ROOT, 'data', f), 'utf8')).regions || []).filter(r => r.region_id).map(r => ({ ...r, region_type: r.region_type || type })); } catch (_) { return []; } };
+  const seen = new Set();
+  const regions = [...load('redfin-regions.json', 6), ...load('redfin-neighborhoods.json', 1)]
+    .filter(r => { const k = r.region_id + ':' + r.region_type; if (seen.has(k)) return false; seen.add(k); return true; });
+  const work = (MAXR ? regions.slice(0, MAXR) : regions);
   console.log(`closed-sales: ${work.length} regions${PROBE ? ' (PROBE)' : ''}`);
 
   // Candidate sold-filter params to try (Redfin's gis-csv sold mode). First that returns rows wins.
@@ -60,7 +64,7 @@ function parseCsv(text) {
     // PROBE: find the sold param that returns rows, on the first region.
     const r0 = work[0];
     for (const v of SOLD_VARIANTS) {
-      const url = `https://www.redfin.com/stingray/api/gis-csv?al=1&region_id=${r0.region_id}&region_type=6&uipt=3&${v}`;
+      const url = `https://www.redfin.com/stingray/api/gis-csv?al=1&region_id=${r0.region_id}&region_type=${r0.region_type}&uipt=3&${v}`;
       const txt = await page.evaluate(async u => { try { const r = await fetch(u); return r.ok ? await r.text() : ('ERR' + r.status); } catch (e) { return 'EXC'; } }, url);
       const n = (typeof txt === 'string' && txt.startsWith('ERR')) ? 0 : parseCsv(txt).length;
       console.log(`  probe [${v}] -> ${typeof txt === 'string' && txt.startsWith('ERR') ? txt : n + ' rows'}`);

← 3fb9caa CRE residential agents: integrate into CRCP — fetch-redfin-a  ·  back to Commercialrealestate  ·  auto-save: 2026-06-28T08:43:43 (2 files) — public/crcp.html 43075b0 →