mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 05:17:35 +00:00
feat: max price filtering (#383)
This commit is contained in:
+9
-1
@@ -1,7 +1,7 @@
|
||||
import {Browser, Page, Response} from 'puppeteer';
|
||||
import {Link, Store} from './model';
|
||||
import {Logger, Print} from '../logger';
|
||||
import {Selector, pageIncludesLabels} from './includes-labels';
|
||||
import {Selector, cardPriceLimit, pageIncludesLabels} from './includes-labels';
|
||||
import {closePage, delay, getSleepTime, isStatusCodeInRange} from '../util';
|
||||
import {Config} from '../config';
|
||||
import {disableBlockerInPage} from '../adblocker';
|
||||
@@ -145,6 +145,14 @@ async function lookupCardInStock(store: Store, page: Page, link: Link) {
|
||||
}
|
||||
}
|
||||
|
||||
if (store.labels.maxPrice) {
|
||||
const priceLimit = await cardPriceLimit(page, store.labels.maxPrice, Config.store.maxPrice, baseOptions);
|
||||
if (priceLimit) {
|
||||
Logger.info(Print.maxPrice(link, store, priceLimit, true));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (store.labels.captcha) {
|
||||
if (await pageIncludesLabels(page, store.labels.captcha, baseOptions)) {
|
||||
Logger.warn(Print.captcha(link, store, true));
|
||||
|
||||
Reference in New Issue
Block a user