forked from goncy/figuncy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
24 lines (19 loc) · 760 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { chromium } from 'playwright'
import notifier from 'node-notifier'
import cron from 'node-cron'
cron.schedule("* * * * *", async () => {
console.log(`Running on: ${new Date().toLocaleString('es-AR', { timeZone: 'America/Buenos_Aires' })}`)
const browser = await chromium.launch()
const page = await browser.newPage()
await page.goto('https://www.zonakids.com/productos/pack-x-25-sobres-de-figuritas-fifa-world-cup-qatar-2022/')
const content = await page.inputValue('#product_form input[type="submit"]')
if (content === 'Sin stock') {
console.log('SIN STOCK')
} else {
notifier.notify({
title: 'HAY FIGURITAS!!',
message: `Se detectó stock en el pack x25 sobres de Panini`
})
}
await browser.close()
})