From 441d9721c9e07541a8ef729eafa2da0d2d27cfba Mon Sep 17 00:00:00 2001 From: Rene Fichtmueller Date: Sat, 4 Apr 2026 07:26:13 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20flexoptix=20catalog=20scraper=20?= =?UTF-8?q?=E2=80=94=201G=20SFP=20coverage=20+=20SKU=20suffix=20+=20pagina?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add 1G SFP search queries ("1G SFP", "SFP LX", "SFP SX", "SFP ZX") — were completely missing - Strip vendor-compat suffix from SKU (S.1303.10.DG:Sx → S.1303.10.DG) to match existing records - Remove 200-product cap, use full API pagination (page >= 50 limit only) - Result: FLEXOPTIX 1G SFP coverage 50% → 97%, overall price coverage 62% → 88% --- packages/scraper/src/scrapers/flexoptix-catalog.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/scraper/src/scrapers/flexoptix-catalog.ts b/packages/scraper/src/scrapers/flexoptix-catalog.ts index 0900d3f..68336d5 100644 --- a/packages/scraper/src/scrapers/flexoptix-catalog.ts +++ b/packages/scraper/src/scrapers/flexoptix-catalog.ts @@ -397,6 +397,10 @@ export async function scrapeFlexoptixCatalog(): Promise { const GRAPHQL_URL = `${BASE}/graphql`; const GRAPHQL_QUERIES = [ + { search: "1G SFP", defaultFF: "SFP", defaultGbps: 1 }, + { search: "SFP LX", defaultFF: "SFP", defaultGbps: 1 }, + { search: "SFP SX", defaultFF: "SFP", defaultGbps: 1 }, + { search: "SFP ZX", defaultFF: "SFP", defaultGbps: 1 }, { search: "SFP+", defaultFF: "SFP+", defaultGbps: 10 }, { search: "SFP28", defaultFF: "SFP28", defaultGbps: 25 }, { search: "QSFP+", defaultFF: "QSFP+", defaultGbps: 40 }, @@ -494,9 +498,13 @@ export async function scrapeFlexoptixCatalog(): Promise { const rawImg = item.small_image?.url; const imageUrl = rawImg && !rawImg.includes("placeholder") ? rawImg : undefined; + // Strip the vendor-compatibility suffix (e.g. ":Sx", ":Ci", ":Ju") from SKU + // The base SKU (before ":") is the canonical FLEXOPTIX part number + const baseSku = item.sku.includes(":") ? item.sku.split(":")[0] : item.sku; + allProducts.set(url, { name: item.name, - partNumber: item.sku, + partNumber: baseSku, url, price: price && price > 0 && price < 100000 ? price : undefined, currency: item.price_range?.minimum_price?.final_price?.currency || "EUR", @@ -515,8 +523,8 @@ export async function scrapeFlexoptixCatalog(): Promise { totalFetched += products.items.length; if (newCount > 0) console.log(` GraphQL "${gq.search}" p${page}: +${newCount} new (${products.items.length} items, ${products.total_count} total)`); - // Stop if we've fetched all pages or reached a reasonable limit - if (totalFetched >= products.total_count || totalFetched >= 200 || page >= 10) break; + // Stop if we've fetched all pages (no artificial cap — let the API determine the limit) + if (totalFetched >= products.total_count || page >= 50) break; page++; await sleep(800); } catch (err) {