mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 11:07:43 +00:00
chore: add sort linting (#169)
This commit is contained in:
@@ -2,10 +2,10 @@ import {Link} from '../store/model';
|
||||
import {sendNotification} from '../notification';
|
||||
|
||||
const link: Link = {
|
||||
series: 'debug',
|
||||
brand: 'brand',
|
||||
cartUrl: 'http://example.com/',
|
||||
model: 'model',
|
||||
series: 'debug',
|
||||
url: 'http://example.com/'
|
||||
};
|
||||
|
||||
|
||||
+12
-12
@@ -1,13 +1,13 @@
|
||||
import {resolve} from 'path';
|
||||
import {config} from 'dotenv';
|
||||
import path from 'path';
|
||||
|
||||
config({path: resolve(__dirname, '../.env')});
|
||||
config({path: path.resolve(__dirname, '../.env')});
|
||||
|
||||
const browser = {
|
||||
isHeadless: process.env.HEADLESS ? process.env.HEADLESS === 'true' : true,
|
||||
open: process.env.OPEN_BROWSER === 'true',
|
||||
maxSleep: Number(process.env.PAGE_SLEEP_MAX ?? 10000),
|
||||
minSleep: Number(process.env.PAGE_SLEEP_MIN ?? 5000),
|
||||
maxSleep: Number(process.env.PAGE_SLEEP_MAX ?? 10000)
|
||||
open: process.env.OPEN_BROWSER === 'true'
|
||||
};
|
||||
|
||||
const logLevel = process.env.LOG_LEVEL ?? 'info';
|
||||
@@ -19,8 +19,8 @@ const notifications = {
|
||||
webHookUrl: process.env.DISCORD_WEB_HOOK ?? ''
|
||||
},
|
||||
email: {
|
||||
username: process.env.EMAIL_USERNAME ?? '',
|
||||
password: process.env.EMAIL_PASSWORD ?? ''
|
||||
password: process.env.EMAIL_PASSWORD ?? '',
|
||||
username: process.env.EMAIL_USERNAME ?? ''
|
||||
},
|
||||
phone: {
|
||||
availableCarriers: new Map([
|
||||
@@ -38,7 +38,7 @@ const notifications = {
|
||||
playSound: process.env.PLAY_SOUND ?? '',
|
||||
pushover: {
|
||||
token: process.env.PUSHOVER_TOKEN ?? '',
|
||||
user: process.env.PUSHOVER_USER ?? ''
|
||||
username: process.env.PUSHOVER_USER ?? ''
|
||||
},
|
||||
slack: {
|
||||
channel: process.env.SLACK_CHANNEL ?? '',
|
||||
@@ -53,18 +53,18 @@ const notifications = {
|
||||
|
||||
const page = {
|
||||
capture: process.env.SCREENSHOT ? process.env.SCREENSHOT === 'true' : 'true',
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
inStockWaitTime: Number(process.env.IN_STOCK_WAIT_TIME ?? 0),
|
||||
navigationTimeout: Number(process.env.PAGE_TIMEOUT ?? 30000),
|
||||
userAgent: process.env.USER_AGENT ?? 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36',
|
||||
inStockWaitTime: Number(process.env.IN_STOCK_WAIT_TIME ?? 0)
|
||||
width: 1920
|
||||
};
|
||||
|
||||
const store = {
|
||||
showOnlySeries: process.env.SHOW_ONLY_SERIES ? process.env.SHOW_ONLY_SERIES.split(',') : ['3070', '3080', '3090'],
|
||||
country: process.env.COUNTRY ?? 'usa',
|
||||
showOnlyBrands: process.env.SHOW_ONLY_BRANDS ? process.env.SHOW_ONLY_BRANDS.split(',') : [],
|
||||
stores: process.env.STORES ? process.env.STORES.split(',') : ['nvidia'],
|
||||
country: process.env.COUNTRY ?? 'usa'
|
||||
showOnlySeries: process.env.SHOW_ONLY_SERIES ? process.env.SHOW_ONLY_SERIES.split(',') : ['3070', '3080', '3090'],
|
||||
stores: process.env.STORES ? process.env.STORES.split(',') : ['nvidia']
|
||||
};
|
||||
|
||||
export const Config = {
|
||||
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
import {Config} from './config';
|
||||
import {Logger} from './logger';
|
||||
import {Stores} from './store/model';
|
||||
import {adBlocker} from './adblocker';
|
||||
import {getSleepTime} from './util';
|
||||
import puppeteer from 'puppeteer-extra';
|
||||
import stealthPlugin from 'puppeteer-extra-plugin-stealth';
|
||||
import {Config} from './config';
|
||||
import {Stores} from './store/model';
|
||||
import {Logger} from './logger';
|
||||
import {tryLookupAndLoop} from './store';
|
||||
import {getSleepTime} from './util';
|
||||
import {adBlocker} from './adblocker';
|
||||
|
||||
puppeteer.use(stealthPlugin());
|
||||
puppeteer.use(adBlocker);
|
||||
@@ -15,11 +15,11 @@ puppeteer.use(adBlocker);
|
||||
*/
|
||||
async function main() {
|
||||
const browser = await puppeteer.launch({
|
||||
headless: Config.browser.isHeadless,
|
||||
defaultViewport: {
|
||||
height: Config.page.height,
|
||||
width: Config.page.width
|
||||
}
|
||||
},
|
||||
headless: Config.browser.isHeadless
|
||||
});
|
||||
|
||||
for (const store of Stores) {
|
||||
|
||||
+2
-4
@@ -12,7 +12,6 @@ const prettyJson = format.printf(info => {
|
||||
});
|
||||
|
||||
export const Logger = winston.createLogger({
|
||||
level: Config.logLevel,
|
||||
format: format.combine(
|
||||
format.colorize(),
|
||||
format.prettyPrint(),
|
||||
@@ -20,7 +19,6 @@ export const Logger = winston.createLogger({
|
||||
format.simple(),
|
||||
prettyJson
|
||||
),
|
||||
transports: [
|
||||
new winston.transports.Console({})
|
||||
]
|
||||
level: Config.logLevel,
|
||||
transports: [new winston.transports.Console({})]
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import notifier from 'node-notifier';
|
||||
import {Link} from '../store/model';
|
||||
import notifier from 'node-notifier';
|
||||
|
||||
export function sendDesktopNotification(cartUrl: string, link: Link) {
|
||||
(async () => {
|
||||
@@ -7,8 +7,8 @@ export function sendDesktopNotification(cartUrl: string, link: Link) {
|
||||
const message = cartUrl;
|
||||
|
||||
notifier.notify({
|
||||
title,
|
||||
message
|
||||
message,
|
||||
title
|
||||
});
|
||||
})();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {Webhook, MessageBuilder} from 'discord-webhook-node';
|
||||
import {MessageBuilder, Webhook} from 'discord-webhook-node';
|
||||
import {Config} from '../config';
|
||||
import {Logger} from '../logger';
|
||||
import {Link} from '../store/model';
|
||||
import {Logger} from '../logger';
|
||||
|
||||
const hook = new Webhook(Config.notifications.discord.webHookUrl);
|
||||
const notifyGroup = Config.notifications.discord.notifyGroup;
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import nodemailer from 'nodemailer';
|
||||
import Mail from 'nodemailer/lib/mailer';
|
||||
import {Config} from '../config';
|
||||
import {Logger} from '../logger';
|
||||
import {Link} from '../store/model';
|
||||
import {Logger} from '../logger';
|
||||
import Mail from 'nodemailer/lib/mailer';
|
||||
import nodemailer from 'nodemailer';
|
||||
|
||||
const email = Config.notifications.email;
|
||||
const subject = 'NVIDIA - BUY NOW';
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
service: 'gmail',
|
||||
auth: {
|
||||
user: email.username,
|
||||
pass: email.password
|
||||
}
|
||||
pass: email.password,
|
||||
user: email.username
|
||||
},
|
||||
service: 'gmail'
|
||||
});
|
||||
|
||||
const mailOptions: Mail.Options = {
|
||||
from: email.username,
|
||||
to: email.username,
|
||||
subject
|
||||
subject,
|
||||
to: email.username
|
||||
};
|
||||
|
||||
export function sendEmail(cartUrl: string, link: Link) {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import {Config} from '../config';
|
||||
import {sendEmail} from './email';
|
||||
import {sendSMS} from './sms';
|
||||
import {playSound} from './sound';
|
||||
import {sendSlackMessage} from './slack';
|
||||
import {sendPushoverNotification} from './pushover';
|
||||
import {sendTelegramMessage} from './telegram';
|
||||
import {sendDiscordMessage} from './discord';
|
||||
import {sendDesktopNotification} from './desktop';
|
||||
|
||||
import {Link} from '../store/model';
|
||||
import {playSound} from './sound';
|
||||
import {sendDesktopNotification} from './desktop';
|
||||
import {sendDiscordMessage} from './discord';
|
||||
import {sendEmail} from './email';
|
||||
import {sendPushoverNotification} from './pushover';
|
||||
import {sendSMS} from './sms';
|
||||
import {sendSlackMessage} from './slack';
|
||||
import {sendTelegramMessage} from './telegram';
|
||||
|
||||
const notifications = Config.notifications;
|
||||
|
||||
@@ -36,7 +35,7 @@ export function sendNotification(cartUrl: string, link: Link) {
|
||||
}
|
||||
}
|
||||
|
||||
if (notifications.pushover.token && notifications.pushover.user) {
|
||||
if (notifications.pushover.token && notifications.pushover.username) {
|
||||
sendPushoverNotification(cartUrl);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import Push from 'pushover-notifications';
|
||||
import {Config} from '../config';
|
||||
import {Logger} from '../logger';
|
||||
import Push from 'pushover-notifications';
|
||||
|
||||
const pushover = Config.notifications.pushover;
|
||||
const push = new Push({
|
||||
user: pushover.user,
|
||||
token: pushover.token
|
||||
token: pushover.token,
|
||||
user: pushover.username
|
||||
});
|
||||
|
||||
export function sendPushoverNotification(cartUrl: string) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {WebClient} from '@slack/web-api';
|
||||
import {Config} from '../config';
|
||||
import {Logger} from '../logger';
|
||||
import {WebClient} from '@slack/web-api';
|
||||
|
||||
const channel = Config.notifications.slack.channel;
|
||||
const token = Config.notifications.slack.token;
|
||||
@@ -9,7 +9,7 @@ const web = new WebClient(token);
|
||||
export function sendSlackMessage(cartUrl: string) {
|
||||
(async () => {
|
||||
try {
|
||||
const result = await web.chat.postMessage({text: cartUrl, channel});
|
||||
const result = await web.chat.postMessage({channel, text: cartUrl});
|
||||
if (!result.ok) {
|
||||
Logger.error(result.error);
|
||||
return;
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import nodemailer from 'nodemailer';
|
||||
import Mail from 'nodemailer/lib/mailer';
|
||||
import {Config} from '../config';
|
||||
import {Logger} from '../logger';
|
||||
import {Link} from '../store/model';
|
||||
import {Logger} from '../logger';
|
||||
import Mail from 'nodemailer/lib/mailer';
|
||||
import nodemailer from 'nodemailer';
|
||||
|
||||
const subject = 'NVIDIA - BUY NOW';
|
||||
const [email, phone] = [Config.notifications.email, Config.notifications.phone];
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
service: 'gmail',
|
||||
auth: {
|
||||
user: email.username,
|
||||
pass: email.password
|
||||
}
|
||||
pass: email.password,
|
||||
user: email.username
|
||||
},
|
||||
service: 'gmail'
|
||||
});
|
||||
|
||||
const mailOptions: Mail.Options = {
|
||||
from: Config.notifications.email.username,
|
||||
to: generateAddress(),
|
||||
subject
|
||||
subject,
|
||||
to: generateAddress()
|
||||
};
|
||||
|
||||
export function sendSMS(text: string, link: Link) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import playerLib from 'play-sound';
|
||||
import {Config} from '../config';
|
||||
import {Logger} from '../logger';
|
||||
import fs from 'fs';
|
||||
import playerLib from 'play-sound';
|
||||
|
||||
const notificationSound = Config.notifications.playSound;
|
||||
const player = playerLib();
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
import {Browser, Response} from 'puppeteer';
|
||||
import {closePage, delay, getSleepTime} from '../util';
|
||||
import {Config} from '../config';
|
||||
import {Logger} from '../logger';
|
||||
import open from 'open';
|
||||
import {Store} from './model';
|
||||
import {sendNotification} from '../notification';
|
||||
import {includesLabels} from './includes-labels';
|
||||
import {closePage, delay, getSleepTime} from '../util';
|
||||
import open from 'open';
|
||||
import {sendNotification} from '../notification';
|
||||
|
||||
const inStock: Record<string, boolean> = {};
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const Adorama: Store = {
|
||||
labels: {
|
||||
captcha: ['please verify you are a human'],
|
||||
outOfStock: ['temporarily not available', 'out of stock']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'TEST',
|
||||
@@ -63,9 +67,5 @@ export const Adorama: Store = {
|
||||
url: 'https://www.adorama.com/png30801tfxb.html'
|
||||
}
|
||||
],
|
||||
labels: {
|
||||
captcha: ['please verify you are a human'],
|
||||
outOfStock: ['temporarily not available', 'out of stock']
|
||||
},
|
||||
name: 'adorama'
|
||||
};
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const AmazonCa: Store = {
|
||||
labels: {
|
||||
captcha: ['enter the characters you see below'],
|
||||
outOfStock: ['currently unavailable']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'TEST',
|
||||
@@ -75,9 +79,5 @@ export const AmazonCa: Store = {
|
||||
url: 'https://www.amazon.ca/MSI-GeForce-RTX-3080-10G/dp/B08HR5SXPS'
|
||||
}
|
||||
],
|
||||
labels: {
|
||||
captcha: ['enter the characters you see below'],
|
||||
outOfStock: ['currently unavailable']
|
||||
},
|
||||
name: 'amazon-ca'
|
||||
};
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const Amazon: Store = {
|
||||
labels: {
|
||||
bannedSeller: ['sports authentics', 'raccoon capitalist', 'gigaparts'],
|
||||
captcha: ['enter the characters you see below'],
|
||||
outOfStock: ['currently unavailable', 'available from these sellers']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'TEST',
|
||||
@@ -93,10 +98,5 @@ export const Amazon: Store = {
|
||||
url: 'https://www.amazon.com/ZOTAC-Graphics-IceStorm-Advanced-ZT-A30800D-10P/dp/B08HJNKT3P'
|
||||
}
|
||||
],
|
||||
labels: {
|
||||
captcha: ['enter the characters you see below'],
|
||||
outOfStock: ['currently unavailable', 'available from these sellers'],
|
||||
bannedSeller: ['sports authentics', 'raccoon capitalist', 'gigaparts']
|
||||
},
|
||||
name: 'amazon'
|
||||
};
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const Asus: Store = {
|
||||
labels: {
|
||||
outOfStock: ['coming soon', 'temporarily sold out']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'asus',
|
||||
@@ -15,9 +18,6 @@ export const Asus: Store = {
|
||||
url: 'https://store.asus.com/us/item/202009AM150000004/'
|
||||
}
|
||||
],
|
||||
labels: {
|
||||
outOfStock: ['coming soon', 'temporarily sold out']
|
||||
},
|
||||
name: 'asus'
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const BAndH: Store = {
|
||||
labels: {
|
||||
outOfStock: ['notify when available', 'try varying your search terms', 'sorry, an unexpected error has occurred']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'TEST',
|
||||
@@ -60,8 +63,5 @@ export const BAndH: Store = {
|
||||
}
|
||||
|
||||
],
|
||||
labels: {
|
||||
outOfStock: ['notify when available', 'try varying your search terms', 'sorry, an unexpected error has occurred.']
|
||||
},
|
||||
name: 'bandh'
|
||||
};
|
||||
|
||||
+17
-17
@@ -1,6 +1,9 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const BestBuy: Store = {
|
||||
labels: {
|
||||
outOfStock: ['sold out', 'coming soon']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'TEST',
|
||||
@@ -12,54 +15,51 @@ export const BestBuy: Store = {
|
||||
brand: 'nvidia',
|
||||
cartUrl: 'https://api.bestbuy.com/click/-/6429440/cart',
|
||||
model: 'founders edition',
|
||||
url: 'https://www.bestbuy.com/site/nvidia-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card-titanium-and-black/6429440.p?skuId=6429440&intl=nosplash',
|
||||
series: '3080'
|
||||
series: '3080',
|
||||
url: 'https://www.bestbuy.com/site/nvidia-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card-titanium-and-black/6429440.p?skuId=6429440&intl=nosplash'
|
||||
},
|
||||
{
|
||||
brand: 'asus',
|
||||
cartUrl: 'https://api.bestbuy.com/click/-/6432445/cart',
|
||||
model: 'rog strix',
|
||||
url: 'https://www.bestbuy.com/site/asus-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-strix-graphics-card-black/6432445.p?skuId=6432445&intl=nosplash',
|
||||
series: '3080'
|
||||
series: '3080',
|
||||
url: 'https://www.bestbuy.com/site/asus-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-strix-graphics-card-black/6432445.p?skuId=6432445&intl=nosplash'
|
||||
},
|
||||
{
|
||||
brand: 'evga',
|
||||
cartUrl: 'https://api.bestbuy.com/click/-/6432399/cart',
|
||||
model: 'xc3 black',
|
||||
url: 'https://www.bestbuy.com/site/evga-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card/6432399.p?skuId=6432399&intl=nosplash',
|
||||
series: '3080'
|
||||
series: '3080',
|
||||
url: 'https://www.bestbuy.com/site/evga-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card/6432399.p?skuId=6432399&intl=nosplash'
|
||||
},
|
||||
{
|
||||
brand: 'evga',
|
||||
cartUrl: 'https://api.bestbuy.com/click/-/6432400/cart',
|
||||
model: 'xc3 ultra',
|
||||
url: 'https://www.bestbuy.com/site/evga-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card/6432400.p?skuId=6432400&intl=nosplash',
|
||||
series: '3080'
|
||||
series: '3080',
|
||||
url: 'https://www.bestbuy.com/site/evga-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card/6432400.p?skuId=6432400&intl=nosplash'
|
||||
},
|
||||
{
|
||||
brand: 'gigabyte',
|
||||
cartUrl: 'https://api.bestbuy.com/click/-/6430620/cart',
|
||||
model: 'gaming oc',
|
||||
url: 'https://www.bestbuy.com/site/gigabyte-geforce-rtx-3080-10g-gddr6x-pci-express-4-0-graphics-card-black/6430620.p?acampID=0&cmp=RMX&loc=Hatch&ref=198&skuId=6430620&intl=nosplash',
|
||||
series: '3080'
|
||||
series: '3080',
|
||||
url: 'https://www.bestbuy.com/site/gigabyte-geforce-rtx-3080-10g-gddr6x-pci-express-4-0-graphics-card-black/6430620.p?acampID=0&cmp=RMX&loc=Hatch&ref=198&skuId=6430620&intl=nosplash'
|
||||
},
|
||||
{
|
||||
brand: 'gigabyte',
|
||||
cartUrl: 'https://api.bestbuy.com/click/-/6430621/cart',
|
||||
model: 'eagle oc',
|
||||
url: 'https://www.bestbuy.com/site/gigabyte-geforce-rtx-3080-10g-gddr6x-pci-express-4-0-graphics-card-black/6430621.p?skuId=6430621&intl=nosplash',
|
||||
series: '3080'
|
||||
series: '3080',
|
||||
url: 'https://www.bestbuy.com/site/gigabyte-geforce-rtx-3080-10g-gddr6x-pci-express-4-0-graphics-card-black/6430621.p?skuId=6430621&intl=nosplash'
|
||||
},
|
||||
{
|
||||
brand: 'msi',
|
||||
cartUrl: 'https://api.bestbuy.com/click/-/6430175/cart',
|
||||
model: 'ventus 3x oc',
|
||||
url: 'https://www.bestbuy.com/site/msi-geforce-rtx-3080-ventus-3x-10g-oc-bv-gddr6x-pci-express-4-0-graphic-card-black-silver/6430175.p?skuId=6430175&intl=nosplash',
|
||||
series: '3080'
|
||||
series: '3080',
|
||||
url: 'https://www.bestbuy.com/site/msi-geforce-rtx-3080-ventus-3x-10g-oc-bv-gddr6x-pci-express-4-0-graphic-card-black-silver/6430175.p?skuId=6430175&intl=nosplash'
|
||||
}
|
||||
],
|
||||
labels: {
|
||||
outOfStock: ['sold out', 'coming soon']
|
||||
},
|
||||
name: 'bestbuy'
|
||||
};
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const EvgaEu: Store = {
|
||||
labels: {
|
||||
outOfStock: ['tbd', 'out of stock', 'error reaching the evga website', 'oops! something broke.']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'evga',
|
||||
@@ -27,8 +30,5 @@ export const EvgaEu: Store = {
|
||||
url: 'https://eu.evga.com/products/product.aspx?pn=10G-P5-3885-KR'
|
||||
}
|
||||
],
|
||||
labels: {
|
||||
outOfStock: ['tbd', 'out of stock', 'error reaching the evga website', 'oops! something broke.']
|
||||
},
|
||||
name: 'evga-eu'
|
||||
};
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const Evga: Store = {
|
||||
labels: {
|
||||
outOfStock: ['out of stock', 'error reaching the evga website', 'oops! something broke.']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'TEST',
|
||||
@@ -39,9 +42,6 @@ export const Evga: Store = {
|
||||
url: 'https://www.evga.com/products/product.aspx?pn=10G-P5-3885-KR'
|
||||
}
|
||||
],
|
||||
labels: {
|
||||
outOfStock: ['out of stock', 'error reaching the evga website', 'oops! something broke.']
|
||||
},
|
||||
name: 'evga'
|
||||
};
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import {timestampUrlParameter} from '../../timestamp-url-parameter';
|
||||
import {Browser, Response} from 'puppeteer';
|
||||
import {NvidiaRegionInfo, regionInfos} from '../nvidia';
|
||||
import {Config} from '../../../config';
|
||||
import {Link} from '../store';
|
||||
import {Logger} from '../../../logger';
|
||||
import open from 'open';
|
||||
import {Link} from '../store';
|
||||
import {Config} from '../../../config';
|
||||
import {NvidiaRegionInfo, regionInfos} from '../nvidia';
|
||||
import {timestampUrlParameter} from '../../timestamp-url-parameter';
|
||||
|
||||
const nvidiaApiKey = '9485fa7b159e42edb08a83bde0d83dia';
|
||||
|
||||
function getRegionInfo(): NvidiaRegionInfo {
|
||||
const country = Array.from(regionInfos.keys()).includes(Config.store.country) ? Config.store.country : 'usa';
|
||||
|
||||
const defaultRegionInfo: NvidiaRegionInfo = {drLocale: 'en_us', nvidiaLocale: 'en_us', fe3080Id: 5438481700, fe3090Id: null, fe2060SuperId: 5379432500};
|
||||
const defaultRegionInfo: NvidiaRegionInfo = {drLocale: 'en_us', fe2060SuperId: 5379432500, fe3080Id: 5438481700, fe3090Id: null, nvidiaLocale: 'en_us'};
|
||||
return regionInfos.get(country) ?? defaultRegionInfo;
|
||||
}
|
||||
|
||||
@@ -116,31 +116,31 @@ export function generateLinks(): Link[] {
|
||||
|
||||
if (fe2060SuperId) {
|
||||
links.push({
|
||||
series: 'debug',
|
||||
brand: 'TEST',
|
||||
model: 'CARD',
|
||||
url: digitalRiverStockUrl(fe2060SuperId, drLocale),
|
||||
openCartAction: generateOpenCartAction(fe2060SuperId, nvidiaLocale, drLocale, 'TEST CARD debug')
|
||||
openCartAction: generateOpenCartAction(fe2060SuperId, nvidiaLocale, drLocale, 'TEST CARD debug'),
|
||||
series: 'debug',
|
||||
url: digitalRiverStockUrl(fe2060SuperId, drLocale)
|
||||
});
|
||||
}
|
||||
|
||||
if (fe3080Id) {
|
||||
links.push({
|
||||
series: '3080',
|
||||
brand: 'nvidia',
|
||||
model: 'founders edition',
|
||||
url: digitalRiverStockUrl(fe3080Id, drLocale),
|
||||
openCartAction: generateOpenCartAction(fe3080Id, nvidiaLocale, drLocale, 'nvidia founders edition 3080')
|
||||
openCartAction: generateOpenCartAction(fe3080Id, nvidiaLocale, drLocale, 'nvidia founders edition 3080'),
|
||||
series: '3080',
|
||||
url: digitalRiverStockUrl(fe3080Id, drLocale)
|
||||
});
|
||||
}
|
||||
|
||||
if (fe3090Id) {
|
||||
links.push({
|
||||
series: '3090',
|
||||
brand: 'nvidia',
|
||||
model: 'founders edition',
|
||||
url: digitalRiverStockUrl(fe3090Id, drLocale),
|
||||
openCartAction: generateOpenCartAction(fe3090Id, nvidiaLocale, drLocale, 'nvidia founders edition 3090')
|
||||
openCartAction: generateOpenCartAction(fe3090Id, nvidiaLocale, drLocale, 'nvidia founders edition 3090'),
|
||||
series: '3090',
|
||||
url: digitalRiverStockUrl(fe3090Id, drLocale)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ import {Adorama} from './adorama';
|
||||
import {Amazon} from './amazon';
|
||||
import {AmazonCa} from './amazon-ca';
|
||||
import {Asus} from './asus';
|
||||
import {BestBuy} from './bestbuy';
|
||||
import {BAndH} from './bandh';
|
||||
import {BestBuy} from './bestbuy';
|
||||
import {Config} from '../../config';
|
||||
import {Evga} from './evga';
|
||||
import {EvgaEu} from './evga-eu';
|
||||
@@ -12,8 +12,8 @@ import {MicroCenter} from './microcenter';
|
||||
import {NewEgg} from './newegg';
|
||||
import {NewEggCa} from './newegg-ca';
|
||||
import {Nvidia} from './nvidia';
|
||||
import {Store} from './store';
|
||||
import {OfficeDepot} from './officedepot';
|
||||
import {Store} from './store';
|
||||
import {Zotac} from './zotac';
|
||||
|
||||
const masterList = new Map([
|
||||
@@ -21,8 +21,8 @@ const masterList = new Map([
|
||||
[Amazon.name, Amazon],
|
||||
[AmazonCa.name, AmazonCa],
|
||||
[Asus.name, Asus],
|
||||
[BestBuy.name, BestBuy],
|
||||
[BAndH.name, BAndH],
|
||||
[BestBuy.name, BestBuy],
|
||||
[Evga.name, Evga],
|
||||
[EvgaEu.name, EvgaEu],
|
||||
[MicroCenter.name, MicroCenter],
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const MicroCenter: Store = {
|
||||
labels: {
|
||||
outOfStock: ['sold out']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'TEST',
|
||||
@@ -45,8 +48,5 @@ export const MicroCenter: Store = {
|
||||
url: 'https://www.microcenter.com/product/628607/zotac-geforce-rtx-3080-trinity-overclocked-triple-fan-10gb-gddr6x-pcie-40-graphics-card'
|
||||
}
|
||||
],
|
||||
labels: {
|
||||
outOfStock: ['sold out']
|
||||
},
|
||||
name: 'microcenter'
|
||||
};
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const NewEggCa: Store = {
|
||||
labels: {
|
||||
captcha: ['are you a human?'],
|
||||
outOfStock: ['auto notify', 'item is currently out of stock']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'TEST',
|
||||
@@ -69,9 +73,5 @@ export const NewEggCa: Store = {
|
||||
url: 'https://www.newegg.ca/asus-geforce-rtx-3080-tuf-rtx3080-o10g-gaming/p/N82E16814126452'
|
||||
}
|
||||
],
|
||||
labels: {
|
||||
captcha: ['are you a human?'],
|
||||
outOfStock: ['auto notify', 'item is currently out of stock']
|
||||
},
|
||||
name: 'newegg-ca'
|
||||
};
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const NewEgg: Store = {
|
||||
labels: {
|
||||
captcha: ['are you a human?'],
|
||||
outOfStock: ['auto notify', 'item is currently out of stock']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'TEST',
|
||||
@@ -100,9 +104,5 @@ export const NewEgg: Store = {
|
||||
url: 'https://www.newegg.com/zotac-geforce-rtx-3080-zt-t30800j-10p/p/N82E16814500504'
|
||||
}
|
||||
],
|
||||
labels: {
|
||||
captcha: ['are you a human?'],
|
||||
outOfStock: ['auto notify', 'item is currently out of stock']
|
||||
},
|
||||
name: 'newegg'
|
||||
};
|
||||
|
||||
+21
-21
@@ -1,42 +1,42 @@
|
||||
import {Store} from './store';
|
||||
import {generateLinks, generateSetupAction} from './helpers/nvidia';
|
||||
import {Store} from './store';
|
||||
|
||||
// Region/country set by config file, silently ignores null / missing values and defaults to usa
|
||||
|
||||
export interface NvidiaRegionInfo {
|
||||
drLocale: string;
|
||||
nvidiaLocale: string;
|
||||
fe3080Id: number | null;
|
||||
fe3090Id: number | null;
|
||||
fe2060SuperId: number | null;
|
||||
nvidiaLocale: string;
|
||||
}
|
||||
|
||||
export const regionInfos = new Map<string, NvidiaRegionInfo>([
|
||||
['austria', {drLocale: 'de_de', nvidiaLocale: 'de_de', fe3080Id: 5440853700, fe3090Id: null, fe2060SuperId: null}],
|
||||
['belgium', {drLocale: 'fr_fr', nvidiaLocale: 'fr_fr', fe3080Id: 5438795700, fe3090Id: null, fe2060SuperId: 5394902700}],
|
||||
['canada', {drLocale: 'en_us', nvidiaLocale: 'en_ca', fe3080Id: 5438481700, fe3090Id: null, fe2060SuperId: null}],
|
||||
['czechia', {drLocale: 'en_gb', nvidiaLocale: 'en_gb', fe3080Id: 5438793800, fe3090Id: null, fe2060SuperId: null}],
|
||||
['denmark', {drLocale: 'en_gb', nvidiaLocale: 'en_gb', fe3080Id: 5438793300, fe3090Id: null, fe2060SuperId: null}],
|
||||
['finland', {drLocale: 'en_gb', nvidiaLocale: 'en_gb', fe3080Id: 5438793300, fe3090Id: null, fe2060SuperId: null}],
|
||||
['france', {drLocale: 'fr_fr', nvidiaLocale: 'fr_fr', fe3080Id: 5438795200, fe3090Id: null, fe2060SuperId: null}],
|
||||
['germany', {drLocale: 'de_de', nvidiaLocale: 'de_de', fe3080Id: 5438792300, fe3090Id: null, fe2060SuperId: null}],
|
||||
['great_britain', {drLocale: 'en_gb', nvidiaLocale: 'en_gb', fe3080Id: 5438792800, fe3090Id: null, fe2060SuperId: null}],
|
||||
['ireland', {drLocale: 'en_gb', nvidiaLocale: 'en_gb', fe3080Id: 5438792800, fe3090Id: null, fe2060SuperId: null}],
|
||||
['italy', {drLocale: 'it_it', nvidiaLocale: 'it_it', fe3080Id: 5438796200, fe3090Id: null, fe2060SuperId: null}],
|
||||
['luxembourg', {drLocale: 'fr_fr', nvidiaLocale: 'fr_fr', fe3080Id: 5438795700, fe3090Id: null, fe2060SuperId: 5394902700}],
|
||||
['poland', {drLocale: 'pl_pl', nvidiaLocale: 'pl_pl', fe3080Id: 5438797700, fe3090Id: null, fe2060SuperId: null}],
|
||||
['portugal', {drLocale: 'en_gb', nvidiaLocale: 'en_gb', fe3080Id: 5438794300, fe3090Id: null, fe2060SuperId: null}],
|
||||
['russia', {drLocale: 'ru_ru', nvidiaLocale: 'ru_ru', fe3080Id: null, fe3090Id: null, fe2060SuperId: null}],
|
||||
['spain', {drLocale: 'es_es', nvidiaLocale: 'es_es', fe3080Id: 5438794800, fe3090Id: null, fe2060SuperId: null}],
|
||||
['sweden', {drLocale: 'sv_SE', nvidiaLocale: 'sv_se', fe3080Id: 5438798100, fe3090Id: null, fe2060SuperId: null}],
|
||||
['usa', {drLocale: 'en_us', nvidiaLocale: 'en_us', fe3080Id: 5438481700, fe3090Id: null, fe2060SuperId: 5379432500}]
|
||||
['austria', {drLocale: 'de_de', fe2060SuperId: null, fe3080Id: 5440853700, fe3090Id: null, nvidiaLocale: 'de_de'}],
|
||||
['belgium', {drLocale: 'fr_fr', fe2060SuperId: 5394902700, fe3080Id: 5438795700, fe3090Id: null, nvidiaLocale: 'fr_fr'}],
|
||||
['canada', {drLocale: 'en_us', fe2060SuperId: null, fe3080Id: 5438481700, fe3090Id: null, nvidiaLocale: 'en_ca'}],
|
||||
['czechia', {drLocale: 'en_gb', fe2060SuperId: null, fe3080Id: 5438793800, fe3090Id: null, nvidiaLocale: 'en_gb'}],
|
||||
['denmark', {drLocale: 'en_gb', fe2060SuperId: null, fe3080Id: 5438793300, fe3090Id: null, nvidiaLocale: 'en_gb'}],
|
||||
['finland', {drLocale: 'en_gb', fe2060SuperId: null, fe3080Id: 5438793300, fe3090Id: null, nvidiaLocale: 'en_gb'}],
|
||||
['france', {drLocale: 'fr_fr', fe2060SuperId: null, fe3080Id: 5438795200, fe3090Id: null, nvidiaLocale: 'fr_fr'}],
|
||||
['germany', {drLocale: 'de_de', fe2060SuperId: null, fe3080Id: 5438792300, fe3090Id: null, nvidiaLocale: 'de_de'}],
|
||||
['great_britain', {drLocale: 'en_gb', fe2060SuperId: null, fe3080Id: 5438792800, fe3090Id: null, nvidiaLocale: 'en_gb'}],
|
||||
['ireland', {drLocale: 'en_gb', fe2060SuperId: null, fe3080Id: 5438792800, fe3090Id: null, nvidiaLocale: 'en_gb'}],
|
||||
['italy', {drLocale: 'it_it', fe2060SuperId: null, fe3080Id: 5438796200, fe3090Id: null, nvidiaLocale: 'it_it'}],
|
||||
['luxembourg', {drLocale: 'fr_fr', fe2060SuperId: 5394902700, fe3080Id: 5438795700, fe3090Id: null, nvidiaLocale: 'fr_fr'}],
|
||||
['poland', {drLocale: 'pl_pl', fe2060SuperId: null, fe3080Id: 5438797700, fe3090Id: null, nvidiaLocale: 'pl_pSl'}],
|
||||
['portugal', {drLocale: 'en_gb', fe2060SuperId: null, fe3080Id: 5438794300, fe3090Id: null, nvidiaLocale: 'en_gb'}],
|
||||
['russia', {drLocale: 'ru_ru', fe2060SuperId: null, fe3080Id: null, fe3090Id: null, nvidiaLocale: 'ru_ru'}],
|
||||
['spain', {drLocale: 'es_es', fe2060SuperId: null, fe3080Id: 5438794800, fe3090Id: null, nvidiaLocale: 'es_es'}],
|
||||
['sweden', {drLocale: 'sv_SE', fe2060SuperId: null, fe3080Id: 5438798100, fe3090Id: null, nvidiaLocale: 'sv_se'}],
|
||||
['usa', {drLocale: 'en_us', fe2060SuperId: 5379432500, fe3080Id: 5438481700, fe3090Id: null, nvidiaLocale: 'en_us'}]
|
||||
]);
|
||||
|
||||
export const Nvidia: Store = {
|
||||
links: generateLinks(),
|
||||
labels: {
|
||||
outOfStock: ['product_inventory_out_of_stock', 'rate limit exceeded', 'request timeout']
|
||||
},
|
||||
links: generateLinks(),
|
||||
name: 'nvidia',
|
||||
setupAction: generateSetupAction()
|
||||
};
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const OfficeDepot: Store = {
|
||||
labels: {
|
||||
captcha: ['please verify you are a human'],
|
||||
outOfStock: ['out of stock for delivery', 'out of stock', 'we are unable to process your last request']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'TEST',
|
||||
@@ -21,9 +25,5 @@ export const OfficeDepot: Store = {
|
||||
url: 'https://www.officedepot.com/a/products/7791294/PNY-GeForce-RTX-3080-10GB-GDDR6X/'
|
||||
}
|
||||
],
|
||||
labels: {
|
||||
captcha: ['please verify you are a human'],
|
||||
outOfStock: ['out of stock for delivery', 'out of stock', 'we are unable to process your last request']
|
||||
},
|
||||
name: 'officedepot'
|
||||
};
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const Zotac: Store = {
|
||||
labels: {
|
||||
outOfStock: ['out of stock', 'this process is automatic']
|
||||
},
|
||||
links: [
|
||||
{
|
||||
brand: 'zotac',
|
||||
@@ -15,9 +18,6 @@ export const Zotac: Store = {
|
||||
url: 'https://store.zotac.com/zotac-gaming-geforce-rtx-3080-trinity-oc-zt-a30800j-10p'
|
||||
}
|
||||
],
|
||||
labels: {
|
||||
outOfStock: ['out of stock', 'this process is automatic']
|
||||
},
|
||||
name: 'zotac'
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'puppeteer';
|
||||
import {Config} from './config';
|
||||
import {Page} from 'puppeteer';
|
||||
import {disableBlockerInPage} from './adblocker';
|
||||
|
||||
export function getSleepTime() {
|
||||
|
||||
Reference in New Issue
Block a user