From 24b366ffdcffe49df890f67f59a74683de7275e2 Mon Sep 17 00:00:00 2001 From: CHUN YU YAO Date: Fri, 9 Jun 2023 22:08:28 +0800 Subject: [PATCH] 2023-06-08, update for macOS arm --- chrome_tixcraft.py | 33 ++++++++++++++++++--------------- config_launcher.py | 2 +- settings.py | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index 1b09c4c..3690287 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -54,7 +54,7 @@ import itertools import ssl ssl._create_default_https_context = ssl._create_unverified_context -CONST_APP_VERSION = u"MaxBot (2023.6.7) ver 10" +CONST_APP_VERSION = "MaxBot (2023.6.8)" CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt" @@ -438,26 +438,29 @@ def load_chromdriver_uc(webdriver_path, adblock_plus_enable, headless): caps["unhandledPromptBehavior"] = u"accept" driver = None - try: - driver = uc.Chrome(executable_path=chromedriver_path, options=options, desired_capabilities=caps, suppress_welcome=False) - except Exception as exc: - error_message = str(exc) - left_part = None - if "Stacktrace:" in error_message: - left_part = error_message.split("Stacktrace:")[0] - print(left_part) + if os.path.exists(chromedriver_path): + try: + driver = uc.Chrome(driver_executable_path=chromedriver_path, options=options, desired_capabilities=caps) + except Exception as exc: + error_message = str(exc) + #print(exc) + left_part = None + if "Stacktrace:" in error_message: + left_part = error_message.split("Stacktrace:")[0] + print(left_part) - if "This version of ChromeDriver only supports Chrome version" in error_message: - print(CONST_CHROME_VERSION_NOT_MATCH_EN) - print(CONST_CHROME_VERSION_NOT_MATCH_TW) + if "This version of ChromeDriver only supports Chrome version" in error_message: + print(CONST_CHROME_VERSION_NOT_MATCH_EN) + print(CONST_CHROME_VERSION_NOT_MATCH_TW) - else: + if driver is None: #print("Oops! web driver not on path:",chromedriver_path ) print('undetected_chromedriver automatically download chromedriver.') try: - driver = uc.Chrome(options=options, desired_capabilities=caps, suppress_welcome=False) + driver = uc.Chrome(options=options, desired_capabilities=caps) except Exception as exc: error_message = str(exc) + #print(exc) left_part = None if "Stacktrace:" in error_message: left_part = error_message.split("Stacktrace:")[0] @@ -10249,7 +10252,7 @@ def main(args): driver = None if not config_dict is None: - for i in range(50): + for i in range(3): driver = get_driver_by_config(config_dict) if not driver is None: break diff --git a/config_launcher.py b/config_launcher.py index 5faaf6a..f08317d 100644 --- a/config_launcher.py +++ b/config_launcher.py @@ -22,7 +22,7 @@ import base64 import threading import subprocess -CONST_APP_VERSION = u"MaxBot (2023.6.7)" +CONST_APP_VERSION = "MaxBot (2023.6.8)" CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json" CONST_MAXBOT_CONFIG_FILE = "settings.json" diff --git a/settings.py b/settings.py index 4d499fb..83e979f 100644 --- a/settings.py +++ b/settings.py @@ -25,7 +25,7 @@ import threading import subprocess import json -CONST_APP_VERSION = u"MaxBot (2023.6.7) ver 10" +CONST_APP_VERSION = "MaxBot (2023.6.8)" CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"