diff --git a/index.js b/index.js index 37f32ca..7695bd3 100644 --- a/index.js +++ b/index.js @@ -6,9 +6,6 @@ const fs = require("fs"); const discordWebhook = "https://discord.com/api/webhooks/1439286509390921749/t2Hb8XloF6zhDRYD1yh_QlkHHa9eHUyXvd9TxZRHwqR_b_OxxbnwDgsm4em8TwA9NQIa"; -// new version works with ceneo.pl only -const productsIds = ["182928416", "95706396", "90180325"]; - function sendMessage(message) { axios.post(discordWebhook, { content: message, @@ -57,7 +54,18 @@ async function compareAndSave(productsPrice) { ); } +async function getProducts() { + const products = await axios + .get( + "https://db.maciaszek.ovh/api/collections/gifts_items/records?fields=ceneo_id&filter=ceneo_id!=''" + ) + .then((response) => response.data.items.map((item) => item.ceneo_id)); + + return products; +} + async function init() { + const productsIds = await getProducts(); const products = []; for (const productId of productsIds) {