check brower in chrome family.

master
Max 2023-11-10 15:40:00 +08:00 committed by GitHub
parent d6729a546b
commit 98cc2a74ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -92,7 +92,7 @@ CONST_WEBDRIVER_TYPE_SELENIUM = "selenium"
CONST_WEBDRIVER_TYPE_UC = "undetected_chromedriver" CONST_WEBDRIVER_TYPE_UC = "undetected_chromedriver"
CONST_WEBDRIVER_TYPE_DP = "DrissionPage" CONST_WEBDRIVER_TYPE_DP = "DrissionPage"
CONST_AUTO_RELOAD_RANDOM_DELAY_MAX_SECOND = 4 CONST_AUTO_RELOAD_RANDOM_DELAY_MAX_SECOND = 4
CONST_CHROME_FAMILY = ["chrome","edge","brave"]
def t_or_f(arg): def t_or_f(arg):
ret = False ret = False
@ -802,8 +802,11 @@ def get_driver_by_config(config_dict):
NETWORK_BLOCKED_URLS.append('*facebook.com/*') NETWORK_BLOCKED_URLS.append('*facebook.com/*')
NETWORK_BLOCKED_URLS.append('*.fbcdn.net/*') NETWORK_BLOCKED_URLS.append('*.fbcdn.net/*')
# Chrome DevTools Protocal
if config_dict["browser"] in CONST_CHROME_FAMILY:
driver.execute_cdp_cmd('Network.setBlockedURLs', {"urls": NETWORK_BLOCKED_URLS}) driver.execute_cdp_cmd('Network.setBlockedURLs', {"urls": NETWORK_BLOCKED_URLS})
driver.execute_cdp_cmd('Network.enable', {}) driver.execute_cdp_cmd('Network.enable', {})
if 'kktix.c' in homepage: if 'kktix.c' in homepage:
if len(config_dict["advanced"]["kktix_account"])>0: if len(config_dict["advanced"]["kktix_account"])>0:
if not 'https://kktix.com/users/sign_in?' in homepage: if not 'https://kktix.com/users/sign_in?' in homepage: