feat(store): add bestbuy.ca (#229)

This commit is contained in:
serg06
2020-09-23 10:56:23 -04:00
committed by GitHub
parent 98c8b1e7b8
commit 22fd22fe74
5 changed files with 33 additions and 2 deletions
+1
View File
@@ -113,6 +113,7 @@ Here is a list of variables that you can use to customize your newly copied `.en
| Amazon (CA) | `amazon-ca`|
| ASUS | `asus` |
| Best Buy | `bestbuy`|
| Best Buy (CA) | `bestbuy-ca`|
| B&H | `bandh`|
| EVGA | `evga`|
| EVGA (EU) | `evga-eu`|
+2 -1
View File
@@ -69,7 +69,8 @@ async function lookup(browser: Browser, store: Store) {
}
async function lookupCard(browser: Browser, store: Store, page: Page, link: Link) {
const response: Response | null = await page.goto(link.url, {waitUntil: 'networkidle0'});
const givenWaitFor = store.customWaitFor ? store.customWaitFor : 'networkidle0';
const response: Response | null = await page.goto(link.url, {waitUntil: givenWaitFor});
const graphicsCard = `${link.brand} ${link.model}`;
if (await lookupCardInStock(store, page)) {
+26
View File
@@ -0,0 +1,26 @@
import {Store} from './store';
export const BestBuyCa: Store = {
customWaitFor: 'domcontentloaded',
labels: {
inStock: {
container: '#root',
text: ['available online']
}
},
links: [
{
brand: 'TEST',
model: 'CARD',
series: 'debug',
url: 'https://www.bestbuy.ca/en-ca/product/msi-nvidia-geforce-rtx-2060-super-gaming-x-8gb-gddr6-video-card/14419420?intl=nosplash'
},
{
brand: 'zotac',
model: 'trinity',
series: '3080',
url: 'https://www.bestbuy.ca/en-ca/product/zotac-geforce-rtx-3080-trinity-10gb-gddr6x-video-card/14953249?intl=nosplash'
}
],
name: 'bestbuy-ca'
};
+2
View File
@@ -5,6 +5,7 @@ import {AmazonCa} from './amazon-ca';
import {Asus} from './asus';
import {BAndH} from './bandh';
import {BestBuy} from './bestbuy';
import {BestBuyCa} from './bestbuy-ca';
import {Config} from '../../config';
import {Evga} from './evga';
import {EvgaEu} from './evga-eu';
@@ -23,6 +24,7 @@ const masterList = new Map([
[Asus.name, Asus],
[BAndH.name, BAndH],
[BestBuy.name, BestBuy],
[BestBuyCa.name, BestBuyCa],
[Evga.name, Evga],
[EvgaEu.name, EvgaEu],
[MicroCenter.name, MicroCenter],
+2 -1
View File
@@ -1,4 +1,4 @@
import {Browser} from 'puppeteer';
import {Browser, LoadEvent} from 'puppeteer';
export interface Element {
container: string;
@@ -25,4 +25,5 @@ export interface Store {
labels: Labels;
name: string;
setupAction?: (browser: Browser) => void;
customWaitFor?: LoadEvent;
}