diff --git a/bot/bot.py b/bot/bot.py index e689ab3..8969562 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -119,13 +119,13 @@ def find_amazon_link(update: Update, context: CallbackContext) -> None: logging.info("Re-loading Amazon webpage") page_html = load_page(url=amazon_url_with_referer, driver=chrome_driver, screenshot_type="_aftercaptcha") product_data = scrape_data(page_html) - - if not product_data: - logging.info("Unable to get the product information") - context.bot.send_message(chat_id=chat_id, text="Unable to get product attributes from the provided url", reply_to_message_id=message_id) - return else: logging.info("Couldn't solve the captcha, if there was any") + + if not product_data: #if after applying the captcha we don't have any data yet, stop the execution and reply to the user + logging.info("Unable to get the product information") + context.bot.send_message(chat_id=chat_id, text="Unable to get product attributes from the provided url", reply_to_message_id=message_id) + return logging.info(f"Product information found: {product_data}")