From 4608d533a116b4d24fe26c12eca41feb56b932ec Mon Sep 17 00:00:00 2001 From: Myned Date: Thu, 22 Oct 2020 19:17:50 -0400 Subject: [PATCH] Fix index error --- src/cogs/weeb.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cogs/weeb.py b/src/cogs/weeb.py index 50b46f2..f74b9c9 100644 --- a/src/cogs/weeb.py +++ b/src/cogs/weeb.py @@ -31,7 +31,10 @@ class Weeb(cmds.Cog): for item, url in urls.items(): browser.get(url) - status = browser.find_elements_by_css_selector('#addToCartText-product-template')[0].text + try: + status = browser.find_elements_by_css_selector('#addToCartText-product-template')[0].text + except IndexError: + status = 'SOLD OUT' if status != 'SOLD OUT': message += f'{item} is in stock at Switchmod!\n<{url}>\n'