mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 04:07:36 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a152f8a5cc | |||
| 00a0687d3e | |||
| d3ec4bc85e | |||
| 1a13c03250 | |||
| 6c6503219f | |||
| efe799b8b9 | |||
| 4a5886782b | |||
| e1a90c931d | |||
| eb4f5e0341 |
@@ -1,3 +1,7 @@
|
||||
<!-- Please use Conventional Commits to label your title -->
|
||||
<!-- https://www.conventionalcommits.org/en/v1.0.0/ -->
|
||||
<!-- Example: feat: allow provided config object to extend other configs -->
|
||||
|
||||
### Description
|
||||
|
||||
<!-- Fixes #(issue) -->
|
||||
|
||||
@@ -16,6 +16,8 @@ jobs:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: ${{ runner.os }}-node-
|
||||
- name: Add problem matcher
|
||||
run: echo "::add-matcher::.github/xo-problem-matcher.json"
|
||||
- name: Pull dependencies
|
||||
run: |
|
||||
npm ci
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "xo",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^\\s+(.*):(\\d+):(\\d+)$",
|
||||
"file": 1
|
||||
},
|
||||
{
|
||||
"regexp": "^\\s+✖\\s+(\\d+):(\\d+)\\s+(.*)\\s+(.*)$",
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"message": 3,
|
||||
"code": 4,
|
||||
"loop": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
## [1.1.0](https://www.github.com/jef/nvidia-snatcher/compare/v1.0.0...v1.1.0) (2020-09-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add conventional commits ([#14](https://www.github.com/jef/nvidia-snatcher/issues/14)) ([eb4f5e0](https://www.github.com/jef/nvidia-snatcher/commit/eb4f5e034176a286eabe381c98ced77cd197d7fb))
|
||||
* add evga ([#17](https://www.github.com/jef/nvidia-snatcher/issues/17)) ([#18](https://www.github.com/jef/nvidia-snatcher/issues/18)) ([6c65032](https://www.github.com/jef/nvidia-snatcher/commit/6c6503219f7c188783c24a44f7052b276a4b39a3))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* exception handling `TimeoutError` ([#20](https://www.github.com/jef/nvidia-snatcher/issues/20)) ([#21](https://www.github.com/jef/nvidia-snatcher/issues/21)) ([00a0687](https://www.github.com/jef/nvidia-snatcher/commit/00a0687d3eba6a8fca871161b447529be00c8896))
|
||||
|
||||
## 1.0.0 (2020-09-18)
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
# nvidia-snatcher [](https://github.com/jef/nvidia-snatcher/actions?query=workflow%3Aci)
|
||||
|
||||
The purpose of this bot is to get an Nvidia card. It does multiple things to try to do that.
|
||||
[FAQ](#FAQ) | [Discord](https://discord.gg/3duFzwk) | [Issues](https://github.com/jef/nvidia-snatcher/issues) | [Wiki](https://github.com/jef/nvidia-snatcher/wiki)
|
||||
|
||||
The purpose of this bot is to get an Nvidia card. It tries multiple things to do that.
|
||||
|
||||
- Currently, `nvidia-snatcher` is not capable of purchasing a card for you
|
||||
- Scrapes multiple websites for patterns of being stocked
|
||||
- API requests are a work in progress (very soon)
|
||||
- Opens browser when stock is available
|
||||
- Send email to you when away from computer
|
||||
- Must have Gmail
|
||||
- Sends an email to you when stock is avaiable (must have Gmail)
|
||||
|
||||
<details>
|
||||
<summary>What you may see if you're lucky</summary>
|
||||
@@ -24,7 +26,7 @@ The purpose of this bot is to get an Nvidia card. It does multiple things to try
|
||||
|
||||
</details>
|
||||
|
||||
> :point_right: You may get false positives from time to time, so I apologize for that. The library currently waits for all calls to be completed before parsing, but sometimes this can unknown behavior. Patience is a virtue :)
|
||||
> :point_right: You may get false positives from time to time, so I apologize for that. The library currently waits for all calls to be completed before parsing, but sometimes this can have unknown behavior. Patience is a virtue :)
|
||||
|
||||
| | **Best Buy** | **B&H** | **Newegg** | **Nvidia** |
|
||||
|:---:|:---:|:---:|:---:|:---:|
|
||||
@@ -32,9 +34,7 @@ The purpose of this bot is to get an Nvidia card. It does multiple things to try
|
||||
| **3080** | `✔` | `✔` | `ℹ` | `✔` |
|
||||
| **3090** | | | | |
|
||||
|
||||
> :point_right: (`ℹ`) In the process of getting working. Catchpa problems are intermittent. Use if you'd like, but expect problems.
|
||||
|
||||
[FAQ](#FAQ) | [Discord](https://discord.gg/3duFzwk) | [Issues](https://github.com/jef/nvidia-snatcher/issues)
|
||||
> :point_right: (`ℹ`) Work in progress. Catchpa problems are intermittent. Use if you'd like, but expect problems.
|
||||
|
||||
## Installation and prerequisites
|
||||
|
||||
@@ -42,15 +42,19 @@ Linux, macOS, and Windows are all capable operating systems.
|
||||
|
||||
You do not need any computer skills, smarts, or anything of that nature. You are very capable as you have made it this far. Some basic understanding how a terminal, git, and or Node.js is a bonus, but that does not limit you to getting `nvidia-snatcher` running!
|
||||
|
||||
- Download [Node.js 14](https://nodejs.org/en/)
|
||||
- Download [git](https://git-scm.com/)
|
||||
- Clone this project `https://github.com/jef/nvidia-snatcher.git`
|
||||
- Run `npm install`
|
||||
- Edit the `.env` file to your liking
|
||||
- More on this in [customization](#Customization)
|
||||
- Run `npm run start`
|
||||
### Quick overview
|
||||
|
||||
Then watch the magic happen!
|
||||
- [Node.js 14](https://nodejs.org/en/)
|
||||
- [git](https://git-scm.com/)
|
||||
- Clone this project `git clone https://github.com/jef/nvidia-snatcher.git`
|
||||
- Run `npm install`
|
||||
- Copy `.env.example` to a new file `.env` and edit the `.env` file to your liking using your [favorite text editor](https://code.visualstudio.com/)
|
||||
- More on this in [customization](#Customization)
|
||||
- Run `npm run start` to start
|
||||
|
||||
At any point you want the program to stop, use <kbd>Ctrl</kbd> + <kbd>C</kbd>.
|
||||
|
||||
> :point_right: Please visit the [wiki](https://github.com/jef/nvidia-snatcher/wiki) if you need more help with installation.
|
||||
|
||||
### Customization
|
||||
|
||||
@@ -62,10 +66,22 @@ First, you're going to need to copy the `.env.example` to `.env`. The current op
|
||||
|:---:|:---:|
|
||||
| `EMAIL_USERNAME` | Gmail address; e.g. `jensen.robbed.us@gmail.com` |
|
||||
| `EMAIL_PASSWORD` | Gmail password; see below if you have MFA |
|
||||
| `STORES` | List of stores you want to be scraped; optional, default: `nvidia` |
|
||||
| `STORES` | List of [stores](#Supported-stores) you want to be scraped; optional, default: `nvidia` |
|
||||
|
||||
> :point_right: If you have multi-factor authentication (MFA), you will need to create an [app password](https://myaccount.google.com/apppasswords) and use this instead of your Gmail password.
|
||||
|
||||
#### Supported stores
|
||||
|
||||
| **Store name** | **Store name environment variable** |
|
||||
|:---:|:---:|
|
||||
| Best Buy | `bestbuy`|
|
||||
| B&H | `bandh`|
|
||||
| EVGA | `evga`|
|
||||
| Newegg | `newegg`|
|
||||
| Nvidia | `nvidia`|
|
||||
|
||||
> :point_right: Look at [`.env.example`](.env.example) for an example for `.env`.
|
||||
|
||||
## FAQ
|
||||
|
||||
**Q: What's Node.js and how do I install it?** Visit [their website](https://nodejs.org/en/) and download and install it. Very straight forward. Otherwise, Google more information related to your system needs.
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nvidia-snatcher",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nvidia-snatcher",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"description": "🔮 For all your Nvidia needs",
|
||||
"main": "src/index.ts",
|
||||
"scripts": {
|
||||
|
||||
+8
-3
@@ -39,15 +39,20 @@ async function lookup(store: Store) {
|
||||
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 textContent = await page.evaluate(body => body.textContent, bodyHandle);
|
||||
|
||||
Logger.debug(textContent);
|
||||
|
||||
const graphicsCard = `${link.brand} ${link.model}`;
|
||||
|
||||
if (isOutOfStock(textContent, link.oosLabels)) {
|
||||
Logger.info(`✖ [${store.name}] ${graphicsCard} is still out of stock`);
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import {Store} from './store';
|
||||
|
||||
export const Evga: Store = {
|
||||
cartUrl: '',
|
||||
links: [
|
||||
{
|
||||
brand: 'evga',
|
||||
model: 'ftw3, xc3 black, xc3 gaming, xc3 ultra gaming',
|
||||
url: 'https://www.evga.com/products/productlist.aspx?type=0&family=GeForce+30+Series+Family&chipset=RTX+3080',
|
||||
oosLabels: ['out of stock']
|
||||
}
|
||||
],
|
||||
name: 'evga'
|
||||
};
|
||||
@@ -1,5 +1,6 @@
|
||||
import {BestBuy} from './bestbuy';
|
||||
import {BAndH} from './bandh';
|
||||
import {Evga} from './evga';
|
||||
import {NewEgg} from './newegg';
|
||||
import {Nvidia} from './nvidia';
|
||||
import {Config} from '../config';
|
||||
@@ -7,6 +8,7 @@ import {Config} from '../config';
|
||||
const list = new Map([
|
||||
['bestbuy', BestBuy],
|
||||
['bandh', BAndH],
|
||||
['evga', Evga],
|
||||
['newegg', NewEgg],
|
||||
['nvidia', Nvidia]
|
||||
]);
|
||||
@@ -19,6 +21,10 @@ if (!Config.stores.toLowerCase().includes('bandh')) {
|
||||
list.delete('bandh');
|
||||
}
|
||||
|
||||
if (!Config.stores.toLowerCase().includes('evga')) {
|
||||
list.delete('evga');
|
||||
}
|
||||
|
||||
if (!Config.stores.toLowerCase().includes('newegg')) {
|
||||
list.delete('newegg');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user