From d5e77261851d0a1676ef62c1aacd8f6d3ca560ed Mon Sep 17 00:00:00 2001 From: Nulo Date: Fri, 22 Dec 2023 17:01:16 -0300 Subject: [PATCH] multiroutine scrap --- scraper/scrap.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scraper/scrap.ts b/scraper/scrap.ts index 4df5bcc..2e6438a 100644 --- a/scraper/scrap.ts +++ b/scraper/scrap.ts @@ -12,6 +12,7 @@ import { getCarrefourProduct } from "./carrefour.js"; import { getDiaProduct } from "./dia.js"; import { getCotoProduct } from "./coto.js"; import { join } from "path"; +import pMap from "p-map"; const sqlite = new Database("sqlite.db"); const db = drizzle(sqlite); @@ -33,9 +34,9 @@ create table precios( ); `); -for (const path of process.argv.slice(2)) { - await parseWarc(path); -} +await pMap(process.argv.slice(2), (path) => parseWarc(path), { + concurrency: 40, +}); const DEBUG = false;