mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 08:47:43 +00:00
Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
+8
-3
@@ -39,15 +39,20 @@ async function lookup(store: Store) {
|
|||||||
width: Config.page.width
|
width: Config.page.width
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.goto(link.url, {waitUntil: 'networkidle0'});
|
const graphicsCard = `${link.brand} ${link.model}`;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await page.goto(link.url, {waitUntil: 'networkidle0'});
|
||||||
|
} catch {
|
||||||
|
Logger.error(`✖ [${store.name}] ${graphicsCard} skipping; timed out`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const bodyHandle = await page.$('body');
|
const bodyHandle = await page.$('body');
|
||||||
const textContent = await page.evaluate(body => body.textContent, bodyHandle);
|
const textContent = await page.evaluate(body => body.textContent, bodyHandle);
|
||||||
|
|
||||||
Logger.debug(textContent);
|
Logger.debug(textContent);
|
||||||
|
|
||||||
const graphicsCard = `${link.brand} ${link.model}`;
|
|
||||||
|
|
||||||
if (isOutOfStock(textContent, link.oosLabels)) {
|
if (isOutOfStock(textContent, link.oosLabels)) {
|
||||||
Logger.info(`✖ [${store.name}] ${graphicsCard} is still out of stock`);
|
Logger.info(`✖ [${store.name}] ${graphicsCard} is still out of stock`);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user