[-] Remove ignored
This commit is contained in:
@@ -14,11 +14,12 @@ from utils import parse_retry
|
|||||||
TG_RECEIVER = '@toronto_ps5_bestbuy'
|
TG_RECEIVER = '@toronto_ps5_bestbuy'
|
||||||
# Telegram bot token
|
# Telegram bot token
|
||||||
TG_TOKEN = os.environ['TG_TOKEN']
|
TG_TOKEN = os.environ['TG_TOKEN']
|
||||||
|
# Alert receiver telegram chat ID
|
||||||
|
ALERT_RECEIVER = -1001655384423
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
CSS = By.CSS_SELECTOR
|
CSS = By.CSS_SELECTOR
|
||||||
AVAIL_TABLE: dict[str, bool] = {}
|
AVAIL_TABLE: dict[str, bool] = {}
|
||||||
IGNORED = []
|
|
||||||
|
|
||||||
|
|
||||||
def send_message(msg: str):
|
def send_message(msg: str):
|
||||||
@@ -34,10 +35,6 @@ def parse_page(browser: Chrome):
|
|||||||
for item in browser.find_elements(By.CLASS_NAME, 'x-productListItem'):
|
for item in browser.find_elements(By.CLASS_NAME, 'x-productListItem'):
|
||||||
title = item.find_element(CSS, 'div[data-automation="productItemName"]').get_attribute('innerHTML')
|
title = item.find_element(CSS, 'div[data-automation="productItemName"]').get_attribute('innerHTML')
|
||||||
|
|
||||||
# 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"]')
|
||||||
|
|
||||||
@@ -62,7 +59,10 @@ def parse_page(browser: Chrome):
|
|||||||
# Available and meets threshold criteria, notify user
|
# Available and meets threshold criteria, notify user
|
||||||
AVAIL_TABLE[title] = True
|
AVAIL_TABLE[title] = True
|
||||||
send_message(f'PS5 Became Available!\n'
|
send_message(f'PS5 Became Available!\n'
|
||||||
f'- [{title}]({link})')
|
f'- [{title}]({link}) ${price:.2f}')
|
||||||
|
|
||||||
|
# Check alert
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user