|
|
|
@ -1,7 +1,6 @@
|
|
|
|
import fetch from 'node-fetch';
|
|
|
|
import fetch from 'node-fetch';
|
|
|
|
|
|
|
|
|
|
|
|
import Aplay from 'node-aplay';
|
|
|
|
import { playAudioFile } from 'audic';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const url = 'https://www.bestbuy.com/gateway/graphql';
|
|
|
|
const url = 'https://www.bestbuy.com/gateway/graphql';
|
|
|
|
|
|
|
|
|
|
|
|
@ -60,10 +59,6 @@ let lines = 0;
|
|
|
|
let found = false;
|
|
|
|
let found = false;
|
|
|
|
let winningResult = null;
|
|
|
|
let winningResult = null;
|
|
|
|
|
|
|
|
|
|
|
|
function playAlarm() {
|
|
|
|
|
|
|
|
new Aplay('alarm.wav').play();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function fetchGraphQL(zip, store, query) {
|
|
|
|
async function fetchGraphQL(zip, store, query) {
|
|
|
|
const body = {
|
|
|
|
const body = {
|
|
|
|
query,
|
|
|
|
query,
|
|
|
|
@ -105,7 +100,7 @@ async function pollStore(zip, store) {
|
|
|
|
if (buttonState !== "SOLD_OUT") {
|
|
|
|
if (buttonState !== "SOLD_OUT") {
|
|
|
|
found = true;
|
|
|
|
found = true;
|
|
|
|
winningResult = { skuId, zip, store, buttonState, data };
|
|
|
|
winningResult = { skuId, zip, store, buttonState, data };
|
|
|
|
playAlarm()
|
|
|
|
await playAudioFile('./alarm.wav');
|
|
|
|
return winningResult;
|
|
|
|
return winningResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|