[+] Add ignored list
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
@@ -32,6 +31,7 @@ MODELS = [
|
|||||||
]
|
]
|
||||||
USD_TO_CAD = 1.27
|
USD_TO_CAD = 1.27
|
||||||
AVAIL_TABLE: dict[str, bool] = {}
|
AVAIL_TABLE: dict[str, bool] = {}
|
||||||
|
IGNORED = []
|
||||||
TITLE_SHORTEN = re.compile('(rtx|nvidia|geforce|edition|gddr[56]x*|video|card)', flags=re.IGNORECASE)
|
TITLE_SHORTEN = re.compile('(rtx|nvidia|geforce|edition|gddr[56]x*|video|card)', flags=re.IGNORECASE)
|
||||||
|
|
||||||
|
|
||||||
@@ -56,6 +56,10 @@ def parse_page(browser: Chrome):
|
|||||||
title = item.find_element(CSS, 'div[data-automation="productItemName"]').get_attribute('innerHTML')
|
title = item.find_element(CSS, 'div[data-automation="productItemName"]').get_attribute('innerHTML')
|
||||||
title = shorten_title(title)
|
title = shorten_title(title)
|
||||||
|
|
||||||
|
# Ignored
|
||||||
|
if title in IGNORED:
|
||||||
|
continue
|
||||||
|
|
||||||
# Check availability
|
# Check availability
|
||||||
avail = item.find_elements(CSS, 'div[data-automation="store-availability-messages"] span[data-automation="store-availability-checkmark"]')
|
avail = item.find_elements(CSS, 'div[data-automation="store-availability-messages"] span[data-automation="store-availability-checkmark"]')
|
||||||
|
|
||||||
@@ -90,7 +94,8 @@ def parse_page(browser: Chrome):
|
|||||||
if price_incr > INCR_MAX:
|
if price_incr > INCR_MAX:
|
||||||
print(' '.join(title.split()[:2]), f'is in stock but price increase {price_incr * 100:.0f}% '
|
print(' '.join(title.split()[:2]), f'is in stock but price increase {price_incr * 100:.0f}% '
|
||||||
f'is larger than defined threshold.')
|
f'is larger than defined threshold.')
|
||||||
# continue
|
IGNORED.append(title)
|
||||||
|
continue
|
||||||
|
|
||||||
# Find link
|
# Find link
|
||||||
link = item.find_element(CSS, 'a').get_attribute('href')
|
link = item.find_element(CSS, 'a').get_attribute('href')
|
||||||
|
|||||||
Reference in New Issue
Block a user