fix(scraper): switch fs-com to de.fs.com for EUR prices as primary source
EUR prices scraped verbatim from de.fs.com — no conversion needed. USD derivation (EUR→USD) happens downstream, not EUR←USD. Fixes price discrepancy: TIP showed USD 999×0.92=EUR 866 vs real €948 on de.fs.com.
This commit is contained in:
parent
e4e432d9fa
commit
dfe86fb347
@ -11,7 +11,9 @@ import { ensureVendor, upsertPriceObservation, findOrCreateScrapedTransceiver, p
|
||||
import { contentHash, parsePrice, parseStockLevel, parseQuantity } from "../utils/hash";
|
||||
import { updateVerifiedSpecs, parseSpecTable } from "../utils/spec-updater";
|
||||
|
||||
const BASE_URL = "https://www.fs.com";
|
||||
// Use German store (de.fs.com) — scrapes EUR prices directly from the website.
|
||||
// EUR is the primary price; USD is derived (EUR → USD), never the reverse.
|
||||
const BASE_URL = "https://de.fs.com";
|
||||
|
||||
const CATEGORY_URLS = [
|
||||
"/c/1g-sfp-81",
|
||||
@ -104,19 +106,20 @@ export async function scrapeFs(): Promise<void> {
|
||||
headless: true,
|
||||
launchContext: {
|
||||
launchOptions: {
|
||||
args: ["--disable-blink-features=AutomationControlled", "--lang=en-US"],
|
||||
args: ["--disable-blink-features=AutomationControlled", "--lang=de-DE"],
|
||||
},
|
||||
},
|
||||
|
||||
preNavigationHooks: [
|
||||
async ({ page }) => {
|
||||
await page.setExtraHTTPHeaders({
|
||||
"Accept-Language": "en-US,en;q=0.9",
|
||||
"Accept-Language": "de-DE,de;q=0.9",
|
||||
});
|
||||
// EUR as primary currency — prices scraped verbatim from de.fs.com
|
||||
await page.context().addCookies([
|
||||
{ name: "currency", value: "USD", domain: ".fs.com", path: "/" },
|
||||
{ name: "lang", value: "en", domain: ".fs.com", path: "/" },
|
||||
{ name: "country", value: "US", domain: ".fs.com", path: "/" },
|
||||
{ name: "currency", value: "EUR", domain: ".fs.com", path: "/" },
|
||||
{ name: "lang", value: "de", domain: ".fs.com", path: "/" },
|
||||
{ name: "country", value: "DE", domain: ".fs.com", path: "/" },
|
||||
]);
|
||||
},
|
||||
],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user