mirror of
https://github.com/catdevnull/preciazo.git
synced 2024-11-26 11:36:20 +00:00
siempre guardar html debug
This commit is contained in:
parent
5312861c42
commit
7e58397c8c
1 changed files with 3 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
import * as schema from "db-datos/schema.js";
|
import * as schema from "db-datos/schema.js";
|
||||||
import { writeFile } from "fs/promises";
|
import { writeFile, mkdir } from "fs/promises";
|
||||||
import { createHash } from "crypto";
|
import { createHash } from "crypto";
|
||||||
import { getCarrefourProduct } from "./parsers/carrefour.js";
|
import { getCarrefourProduct } from "./parsers/carrefour.js";
|
||||||
import { getDiaProduct } from "./parsers/dia.js";
|
import { getDiaProduct } from "./parsers/dia.js";
|
||||||
|
@ -8,7 +8,7 @@ import { join } from "path";
|
||||||
import { db } from "db-datos/db.js";
|
import { db } from "db-datos/db.js";
|
||||||
import pMap from "p-map";
|
import pMap from "p-map";
|
||||||
|
|
||||||
const DEBUG = false;
|
const DEBUG = true;
|
||||||
const PARSER_VERSION = 4;
|
const PARSER_VERSION = 4;
|
||||||
|
|
||||||
export type Precio = typeof schema.precios.$inferInsert;
|
export type Precio = typeof schema.precios.$inferInsert;
|
||||||
|
@ -78,6 +78,7 @@ export async function downloadList(path: string) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
const urlHash = createHash("md5").update(urlS).digest("hex");
|
const urlHash = createHash("md5").update(urlS).digest("hex");
|
||||||
const output = join("debug", `${urlHash}.html`);
|
const output = join("debug", `${urlHash}.html`);
|
||||||
|
await mkdir("debug", { recursive: true });
|
||||||
await writeFile(output, html);
|
await writeFile(output, html);
|
||||||
console.error(`wrote html to ${output}`);
|
console.error(`wrote html to ${output}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue