use chromedriver_autodownload instead of uc auto download.
parent
bf3223ffef
commit
6958685b1a
|
@ -55,7 +55,7 @@ import argparse
|
||||||
import itertools
|
import itertools
|
||||||
import chromedriver_autoinstaller
|
import chromedriver_autoinstaller
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2023.07.22)"
|
CONST_APP_VERSION = "MaxBot (2023.07.23)"
|
||||||
|
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
||||||
|
@ -562,6 +562,9 @@ def load_chromdriver_uc(config_dict):
|
||||||
|
|
||||||
driver = None
|
driver = None
|
||||||
if os.path.exists(chromedriver_path):
|
if os.path.exists(chromedriver_path):
|
||||||
|
# use chromedriver_autodownload instead of uc auto download.
|
||||||
|
is_cache_exist = clean_uc_exe_cache()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
driver = uc.Chrome(driver_executable_path=chromedriver_path, options=options, headless=config_dict["advanced"]["headless"])
|
driver = uc.Chrome(driver_executable_path=chromedriver_path, options=options, headless=config_dict["advanced"]["headless"])
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
@ -576,20 +579,14 @@ def load_chromdriver_uc(config_dict):
|
||||||
print(CONST_CHROME_VERSION_NOT_MATCH_EN)
|
print(CONST_CHROME_VERSION_NOT_MATCH_EN)
|
||||||
print(CONST_CHROME_VERSION_NOT_MATCH_TW)
|
print(CONST_CHROME_VERSION_NOT_MATCH_TW)
|
||||||
|
|
||||||
is_cache_exist = clean_uc_exe_cache()
|
# remove exist chromedriver, download again.
|
||||||
if is_cache_exist:
|
|
||||||
try:
|
|
||||||
driver = uc.Chrome(driver_executable_path=chromedriver_path, options=options, headless=config_dict["advanced"]["headless"])
|
|
||||||
except Exception as exc:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
# remove exist download again.
|
|
||||||
try:
|
try:
|
||||||
os.unlink(chromedriver_path)
|
os.unlink(chromedriver_path)
|
||||||
except PermissionError:
|
except PermissionError:
|
||||||
pass
|
pass
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
chromedriver_autoinstaller.install(path="webdriver", make_version_dir=False)
|
chromedriver_autoinstaller.install(path="webdriver", make_version_dir=False)
|
||||||
try:
|
try:
|
||||||
driver = uc.Chrome(driver_executable_path=chromedriver_path, options=options, headless=config_dict["advanced"]["headless"])
|
driver = uc.Chrome(driver_executable_path=chromedriver_path, options=options, headless=config_dict["advanced"]["headless"])
|
||||||
|
|
Loading…
Reference in New Issue