-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
30 lines (30 loc) · 1.32 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const axios = require('axios')
const toast = require('powertoast')
const waitFor = (ms) => new Promise(r => setTimeout(r, ms * 1000))
const stores = []
// ^ list your store numbers as such: const stores = [100,102,103]
const cache = []
async function StartApp() {
while (true) {
for (store in stores) {
const current_store = stores[store]
const response = await axios.get(`https://www.riteaid.com/services/ext/v2/vaccine/checkSlots?storeNumber=${current_store}`)
const slots = response.data.Data
const incache = cache.find(x => x === current_store)
if (!!slots[0] && !!incache) { // Vaccine IS in stock, and you've not been notified yet
cache.push(current_store)
toast({
title: "COVID Vaccine In Stock",
message: `Store ${current_store} has the vaccine in stock`,
onClick: `http://google.com/search?q=riteaid+${current_store}`,
icon: "https://ichef.bbci.co.uk/news/1024/cpsprodpb/EAD2/production/_114241106_vaccineillus976_rtrs.jpg"
}).catch((err) => {
console.error(err);
});
}
await waitFor(2) // prevent ratelimit
}
await waitFor(30) // prevent ratelimit
}
}
StartApp()