diff --git a/scrap_new_items.js b/scrap_new_items.js index aac9ee8..fc6f388 100644 --- a/scrap_new_items.js +++ b/scrap_new_items.js @@ -146,8 +146,8 @@ async function scrapeWithPuppeteer(store) { const priceEl = node.querySelector(".s-card__price"); if (priceEl) { let text = priceEl.textContent.replace(",", "").trim(); - text = text.replace("£", "GBP").replace("$", ""); - + text = text.replace("£", "GBP ").replace("$", ""); + payload.priceText = text; const match = text.match(/([A-Za-z]{3})?\s?([\d.,]+)\s?([A-Za-z]{3})?/); if (match) { payload.currencyID = match[1] || match[3] || ""; @@ -158,7 +158,7 @@ async function scrapeWithPuppeteer(store) { payload.currencyID = match[1] || match[3] || ""; } } - if (!payload.currencyID?.trim()) payload.currencyID = "AU"; + // if (!payload.currencyID?.trim()) payload.currencyID = ""; } } @@ -401,7 +401,7 @@ async function main() { // 3️⃣ Insert new record const title = (item.title || "").replace("Opens in a new window or tab", "").trim(); - // console.log({ ...item, title }); + console.log({ ...item, title }); await axios .post( process.env.API_DISTI_HOST + "/api/items/insert",