[object Object]

← back to Vendor Agents Viewer

agent-host: normalize scraper output — accept bare array or {vendor,products} wrapper (new feed-first scrapers use the wrapper; scan was failing with .slice is not a function)

47c3aaa220f897bd057e5008cdcbba7d036d1823 · 2026-06-10 16:30:02 -0700 · SteveStudio2

Files touched

Diff

commit 47c3aaa220f897bd057e5008cdcbba7d036d1823
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Wed Jun 10 16:30:02 2026 -0700

    agent-host: normalize scraper output — accept bare array or {vendor,products} wrapper (new feed-first scrapers use the wrapper; scan was failing with .slice is not a function)
---
 agent-host.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/agent-host.js b/agent-host.js
index a6e4f8c..ee09469 100644
--- a/agent-host.js
+++ b/agent-host.js
@@ -39,7 +39,9 @@ function runScraper(maxResults = 20) {
           if(typeof m.default==='function' && !fn) fn = m.default;
           if(typeof fn!=='function'){ console.log(JSON.stringify({ok:false,error:'no callable scraper export'})); return; }
           const out = await fn({ maxResults: ${maxResults} });
-          console.log(JSON.stringify({ ok:true, count:(out||[]).length, sample:(out||[]).slice(0,8) }));
+          // scrapers return either a bare array or a {vendor, products} wrapper
+          const arr = Array.isArray(out) ? out : (out && Array.isArray(out.products) ? out.products : []);
+          console.log(JSON.stringify({ ok:true, count:arr.length, sample:arr.slice(0,8) }));
         }catch(e){ console.log(JSON.stringify({ ok:false, error: String(e&&e.message||e) })); }
         process.exit(0);
       })();`;

← 6eba3c5 alias map: elitis->elitis-wallcovering, DWDP->dwdp exact-cas  ·  back to Vendor Agents Viewer  ·  label intentional no-scrape vendors honestly: API exposes sk 9768cb4 →