From de3bf4900c88a81b0d6e7f6d8a2cce1de61c96b5 Mon Sep 17 00:00:00 2001 From: Nulo Date: Fri, 29 Dec 2023 20:08:01 -0300 Subject: [PATCH] coto: trimmear titulo --- scraper/parsers/coto.ts | 4 +++- scraper/scrap.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scraper/parsers/coto.ts b/scraper/parsers/coto.ts index 31daaee..621614e 100644 --- a/scraper/parsers/coto.ts +++ b/scraper/parsers/coto.ts @@ -34,7 +34,9 @@ export function getCotoProduct(html: string | Buffer): Precioish { const ean = getEanFromText(dom); const precioCentavos = getPriceFromText(dom); - const name = dom.document.querySelector("h1.product_page")?.textContent; + const name = dom.document + .querySelector("h1.product_page") + ?.textContent?.trim(); const imageUrl = dom.document.querySelector( ".productImageZoom img" )?.src; diff --git a/scraper/scrap.ts b/scraper/scrap.ts index 2759c74..f6928ed 100644 --- a/scraper/scrap.ts +++ b/scraper/scrap.ts @@ -13,7 +13,7 @@ import { DB_PATH } from "db-datos/drizzle.config.js"; import { migrateDb } from "db-datos/migrate.js"; const DEBUG = false; -const PARSER_VERSION = 2; +const PARSER_VERSION = 3; migrateDb();