From 4d22d8608904fde9dc7a75ad2e4a00ade427d134 Mon Sep 17 00:00:00 2001 From: CHUN YU YAO Date: Thu, 10 Nov 2022 04:16:41 +0800 Subject: [PATCH] 2022-11-10, remove extension --- chrome_tixcraft.py | 22 +++++++++++++++++----- settings.py | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index 11262a8..4ee1c8d 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -67,7 +67,7 @@ ssl._create_default_https_context = ssl._create_unverified_context #附註1:沒有寫的很好,很多地方應該可以模組化。 #附註2: -CONST_APP_VERSION = u"MaxBot (2022.11.09)" +CONST_APP_VERSION = u"MaxBot (2022.11.10)" CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom" CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top" @@ -142,8 +142,11 @@ def get_config_dict(): def format_keyword_string(keyword): if not keyword is None: if len(keyword) > 0: - keyword = keyword.replace(',','') keyword = keyword.replace('/','/') + keyword = keyword.replace(' ','') + keyword = keyword.replace(',','') + keyword = keyword.replace(',','') + keyword = keyword.replace('$','') keyword = keyword.replace(' ','').lower() return keyword @@ -181,12 +184,15 @@ def load_chromdriver_normal(webdriver_path, driver_type): chromedriver_path = get_chromedriver_path(webdriver_path) + # some windows cause: timed out receiving message from renderer + ''' no_google_analytics_path, no_ad_path = get_favoriate_extension_path(webdriver_path) if os.path.exists(no_google_analytics_path): chrome_options.add_extension(no_google_analytics_path) if os.path.exists(no_ad_path): chrome_options.add_extension(no_ad_path) + ''' chrome_options.add_argument('--disable-features=TranslateUI') chrome_options.add_argument('--disable-translate') @@ -237,6 +243,7 @@ def load_chromdriver_uc(webdriver_path): options.page_load_strategy="eager" #print("strategy", options.page_load_strategy) + ''' no_google_analytics_path, no_ad_path = get_favoriate_extension_path(webdriver_path) no_google_analytics_folder_path = no_google_analytics_path.replace('.crx','') no_ad_folder_path = no_ad_path.replace('.crx','') @@ -247,6 +254,7 @@ def load_chromdriver_uc(webdriver_path): load_extension_path += "," + no_ad_folder_path if len(load_extension_path) > 0: options.add_argument('--load-extension=' + load_extension_path[1:]) + ''' options.add_argument('--disable-features=TranslateUI') options.add_argument('--disable-translate') @@ -572,10 +580,12 @@ def load_config_from_local(driver): driver = webdriver.Firefox(service=firefox_service) - time.sleep(15.0) + time.sleep(1.0) #print("try to close opened tabs.") - for i in range(2): + ''' + for i in range(1): close_browser_tabs(driver) + ''' if driver is None: print("create web driver object fail @_@;") @@ -590,8 +600,10 @@ def load_config_from_local(driver): print('get URL Exception:', exec1) pass - for i in range(2): + ''' + for i in range(1): close_browser_tabs(driver) + ''' else: diff --git a/settings.py b/settings.py index 2065f9e..bc3fa24 100644 --- a/settings.py +++ b/settings.py @@ -19,7 +19,7 @@ import sys import platform import json -CONST_APP_VERSION = u"MaxBot (2022.11.09)" +CONST_APP_VERSION = u"MaxBot (2022.11.10)" CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom" CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top" @@ -994,7 +994,7 @@ def main(): GUI = MainMenu(root) GUI_SIZE_WIDTH = 420 - GUI_SIZE_HEIGHT = 495 + GUI_SIZE_HEIGHT = 498 GUI_SIZE_MACOS = str(GUI_SIZE_WIDTH) + 'x' + str(GUI_SIZE_HEIGHT) GUI_SIZE_WINDOWS=str(GUI_SIZE_WIDTH-60) + 'x' + str(GUI_SIZE_HEIGHT-20)