feat(store): specify links to navigate to between product searches (#1542)

Fixes #1504

When querying a store, if `deterrentLinks` has been defined, pick one at random and navigate there then wait 3 seconds. This should help reduce the likelihood of being sent to a captcha on subsequent page loads from the same store.
This commit is contained in:
neatchee
2021-01-17 05:27:08 -08:00
committed by GitHub
parent 2120d2901d
commit 09827741ae
4 changed files with 96 additions and 0 deletions
+10
View File
@@ -2,6 +2,16 @@ import {Store} from './store';
export const Amazon: Store = {
backoffStatusCodes: [403, 429, 503],
captchaDeterrent: {
hardLinks: [
'https://www.amazon.com/Amazon-Video/b/?ie=UTF8&node=2858778011&ref_=nav_cs_prime_video',
'https://www.amazon.com/alm/storefront?almBrandId=VUZHIFdob2xlIEZvb2Rz&ref_=nav_cs_whole_foods_in_region',
'https://www.amazon.com/gp/goldbox?ref_=nav_cs_gb'
],
searchTerms: ['goober', 'dungeons+and+dragons'],
searchUrl:
'https://www.amazon.com/s?k=%%s&i=todays-deals&ref=nb_sb_noss_2'
},
currency: '$',
labels: {
captcha: {
+11
View File
@@ -12,6 +12,7 @@ export type Pricing = {
export type Brand =
| 'test:brand'
| 'captcha-deterrent'
| 'amd'
| 'asrock'
| 'asus'
@@ -37,6 +38,7 @@ export type Brand =
export type Series =
| 'test:series'
| 'captcha-deterrent'
| '3060ti'
| '3070'
| '3080'
@@ -57,6 +59,7 @@ export type Series =
export type Model =
| 'test:model'
| 'captcha-deterrent'
| '5600x'
| '5800x'
| '5900x'
@@ -181,6 +184,12 @@ export type Labels = {
maxPrice?: Pricing;
};
export type CaptchaDeterrent = {
hardLinks?: string[];
searchUrl?: string;
searchTerms?: string[];
};
export type StatusCodeRangeArray = Array<number | [number, number]>;
export type Store = {
@@ -215,4 +224,6 @@ export type Store = {
proxyList?: string[];
currentProxyIndex?: number;
captchaDeterrent?: CaptchaDeterrent;
};