coto: parsear la imagen correcta

sino se captura la imagen de "OFERTA!"
This commit is contained in:
Cat /dev/Nulo 2023-12-30 00:08:00 -03:00
parent f8cdbae1b3
commit 5dcc901a80
2 changed files with 3 additions and 4 deletions

View file

@ -37,9 +37,8 @@ export function getCotoProduct(html: string | Buffer): Precioish {
const name = dom.document const name = dom.document
.querySelector("h1.product_page") .querySelector("h1.product_page")
?.textContent?.trim(); ?.textContent?.trim();
const imageUrl = dom.document.querySelector<HTMLImageElement>( const imageUrl =
".productImageZoom img" dom.document.querySelector<HTMLImageElement>(".zoom img")?.src;
)?.src;
return { name, imageUrl, ean, precioCentavos }; return { name, imageUrl, ean, precioCentavos };
} }

View file

@ -10,7 +10,7 @@ import { and, eq, sql } from "drizzle-orm";
import { db } from "db-datos/db.js"; import { db } from "db-datos/db.js";
const DEBUG = false; const DEBUG = false;
const PARSER_VERSION = 3; const PARSER_VERSION = 4;
const getPrevPrecio = db const getPrevPrecio = db
.select({ id: schema.precios.id }) .select({ id: schema.precios.id })