Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(store): add bannedSeller label for stores #173

Merged
merged 15 commits into from
Sep 21, 2020
2 changes: 2 additions & 0 deletions src/store/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ async function lookup(browser: Browser, store: Store) {

if (includesLabels(textContent, store.labels.outOfStock)) {
Logger.info(`✖ [${store.name}] still out of stock: ${graphicsCard}`);
} else if (store.labels.bannedSeller && includesLabels(textContent, store.labels.bannedSeller)) {
Logger.warn(`✖ [${store.name}] banned seller detected: ${graphicsCard}. skipping...`);
} else if (store.labels.captcha && includesLabels(textContent, store.labels.captcha)) {
Logger.warn(`✖ [${store.name}] CAPTCHA from: ${graphicsCard}. Waiting for a bit with this store...`);
await delay(getSleepTime());
Expand Down
3 changes: 2 additions & 1 deletion src/store/model/amazon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export const Amazon: Store = {
],
labels: {
captcha: ['enter the characters you see below'],
outOfStock: ['currently unavailable', 'available from these sellers']
outOfStock: ['currently unavailable', 'available from these sellers'],
bannedSeller: ['sports authentics', 'raccoon capitalist', 'gigaparts']
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

Let's make this an environment variable at some point as well!

},
name: 'amazon'
};
2 changes: 1 addition & 1 deletion src/store/model/bandh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const BAndH: Store = {

],
labels: {
outOfStock: ['notify when available']
outOfStock: ['notify when available', 'try varying your search terms']
},
name: 'bandh'
};
2 changes: 1 addition & 1 deletion src/store/model/evga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Evga: Store = {
}
],
labels: {
outOfStock: ['out of stock']
outOfStock: ['out of stock', 'error reaching the evga website']
},
name: 'evga'
};
Expand Down
1 change: 1 addition & 0 deletions src/store/model/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface Link {
export interface Labels {
outOfStock: string[];
captcha?: string[];
bannedSeller?: string[];
}

export interface Store {
Expand Down