diff --git a/index.js b/index.js index 76f570e..2bddce5 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ import path from "path"; import dayjs from "dayjs"; import mysql from "mysql2/promise"; -const EMAILS = ["andrew.ng@apactech.io"]; +const EMAILS = ["andrew.ng@apactech.io", "dev@apactech.io"]; const LIST_STORE = [ { @@ -128,8 +128,10 @@ async function scrapeWithCheerio(url) { const priceText = $(el).find(".s-card__price").text().trim().replace(",", ""); const match = priceText.match(/([£$€A-Za-z]{1,5})?\s?([\d.,]+)\s?([£$€A-Za-z]{1,5})?/); if (match) { + const currency = match[1] || match[3] || ""; payload.price = match[2]; - payload.currency = match[1] || match[3]; + payload.currency = currency.replace("£", "GBP").replace("$", "USD"); + if(!payload.currency?.trim()) payload.currency = "USD"; } if (payload.id) items.push(payload);