2024-03-22, fixbug for nodriver

master
CHUN YU YAO 2024-04-04 13:58:16 +08:00
parent 60785369ea
commit 1c3acaf764
10 changed files with 145 additions and 172 deletions

View File

@ -44,7 +44,7 @@ except Exception as exc:
print(exc) print(exc)
pass pass
CONST_APP_VERSION = "MaxBot (2024.03.21)" CONST_APP_VERSION = "MaxBot (2024.03.22)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -167,6 +167,10 @@ def get_config_dict(args):
if len(args.proxy_server) > 2: if len(args.proxy_server) > 2:
config_dict["advanced"]["proxy_server_port"] = args.proxy_server config_dict["advanced"]["proxy_server_port"] = args.proxy_server
if not args.window_size is None:
if len(args.window_size) > 2:
config_dict["advanced"]["window_size"] = args.window_size
# special case for headless to enable away from keyboard mode. # special case for headless to enable away from keyboard mode.
is_headless_enable_ocr = False is_headless_enable_ocr = False
if config_dict["advanced"]["headless"]: if config_dict["advanced"]["headless"]:
@ -241,17 +245,43 @@ def get_chrome_options(webdriver_path, config_dict):
chrome_options.add_argument('--headless=new') chrome_options.add_argument('--headless=new')
chrome_options.add_argument("--user-agent=%s" % (USER_AGENT)) chrome_options.add_argument("--user-agent=%s" % (USER_AGENT))
chrome_options.add_argument("--password-store=basic")
chrome_options.add_argument("--disable-animations") chrome_options.add_argument("--disable-animations")
chrome_options.add_argument("--disable-background-networking")
chrome_options.add_argument("--disable-backgrounding-occluded-windows")
chrome_options.add_argument("--disable-bookmark-reordering")
chrome_options.add_argument("--disable-boot-animation")
chrome_options.add_argument("--disable-breakpad")
chrome_options.add_argument("--disable-canvas-aa")
chrome_options.add_argument("--disable-client-side-phishing-detection")
chrome_options.add_argument("--disable-cloud-import")
chrome_options.add_argument("--disable-component-cloud-policy")
chrome_options.add_argument("--disable-component-update")
chrome_options.add_argument("--disable-composited-antialiasing")
chrome_options.add_argument("--disable-default-apps")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--disable-device-discovery-notifications")
chrome_options.add_argument("--disable-dinosaur-easter-egg")
chrome_options.add_argument("--disable-domain-reliability")
chrome_options.add_argument("--disable-features=IsolateOrigins,site-per-process,TranslateUI")
chrome_options.add_argument("--disable-infobars") chrome_options.add_argument("--disable-infobars")
chrome_options.add_argument("--disable-logging")
chrome_options.add_argument("--disable-login-animations")
chrome_options.add_argument("--disable-login-screen-apps")
chrome_options.add_argument("--disable-notifications") chrome_options.add_argument("--disable-notifications")
chrome_options.add_argument("--disable-popup-blocking") chrome_options.add_argument("--disable-popup-blocking")
chrome_options.add_argument("--disable-print-preview") chrome_options.add_argument("--disable-print-preview")
chrome_options.add_argument("--disable-renderer-backgrounding")
chrome_options.add_argument("--disable-session-crashed-bubble")
chrome_options.add_argument("--disable-smooth-scrolling") chrome_options.add_argument("--disable-smooth-scrolling")
chrome_options.add_argument("--disable-sync") chrome_options.add_argument("--disable-sync")
chrome_options.add_argument("--no-sandbox"); chrome_options.add_argument("--disable-translate")
chrome_options.add_argument('--disable-features=TranslateUI') chrome_options.add_argument("--lang=zh-TW")
chrome_options.add_argument('--disable-translate') chrome_options.add_argument("--no-default-browser-check")
chrome_options.add_argument('--lang=zh-TW') chrome_options.add_argument("--no-first-run")
chrome_options.add_argument("--no-pings")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--no-service-autorun")
# for navigator.webdriver # for navigator.webdriver
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation']) chrome_options.add_experimental_option("excludeSwitches", ['enable-automation'])
@ -381,19 +411,43 @@ def get_uc_options(uc, config_dict, webdriver_path):
options.add_argument('--headless=new') options.add_argument('--headless=new')
options.add_argument("--user-agent=%s" % (USER_AGENT)) options.add_argument("--user-agent=%s" % (USER_AGENT))
options.add_argument("--password-store=basic")
options.add_argument("--disable-animations") options.add_argument("--disable-animations")
options.add_argument("--disable-background-networking")
options.add_argument("--disable-backgrounding-occluded-windows")
options.add_argument("--disable-bookmark-reordering")
options.add_argument("--disable-boot-animation")
options.add_argument("--disable-breakpad")
options.add_argument("--disable-canvas-aa")
options.add_argument("--disable-client-side-phishing-detection")
options.add_argument("--disable-cloud-import")
options.add_argument("--disable-component-cloud-policy")
options.add_argument("--disable-component-update")
options.add_argument("--disable-composited-antialiasing")
options.add_argument("--disable-default-apps")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--disable-device-discovery-notifications")
options.add_argument("--disable-dinosaur-easter-egg")
options.add_argument("--disable-domain-reliability")
options.add_argument("--disable-features=IsolateOrigins,site-per-process,TranslateUI")
options.add_argument("--disable-infobars") options.add_argument("--disable-infobars")
options.add_argument("--disable-logging")
options.add_argument("--disable-login-animations")
options.add_argument("--disable-login-screen-apps")
options.add_argument("--disable-notifications") options.add_argument("--disable-notifications")
options.add_argument("--disable-popup-blocking") options.add_argument("--disable-popup-blocking")
options.add_argument("--disable-print-preview") options.add_argument("--disable-print-preview")
options.add_argument("--disable-renderer-backgrounding")
options.add_argument("--disable-session-crashed-bubble")
options.add_argument("--disable-smooth-scrolling") options.add_argument("--disable-smooth-scrolling")
options.add_argument("--disable-sync") options.add_argument("--disable-sync")
options.add_argument("--no-sandbox"); options.add_argument("--disable-translate")
options.add_argument('--disable-features=TranslateUI') options.add_argument("--lang=zh-TW")
options.add_argument('--disable-translate') options.add_argument("--no-default-browser-check")
options.add_argument('--lang=zh-TW') options.add_argument("--no-first-run")
options.add_argument("--no-pings")
options.add_argument("--password-store=basic") options.add_argument("--no-sandbox")
options.add_argument("--no-service-autorun")
options.add_experimental_option("prefs", {"credentials_enable_service": False, "profile.password_manager_enabled": False, "translate":{"enabled": False}}) options.add_experimental_option("prefs", {"credentials_enable_service": False, "profile.password_manager_enabled": False, "translate":{"enabled": False}})
if len(config_dict["advanced"]["proxy_server_port"]) > 2: if len(config_dict["advanced"]["proxy_server_port"]) > 2:
@ -11076,6 +11130,10 @@ def cli():
choices=['chrome','firefox','edge','safari','brave'], choices=['chrome','firefox','edge','safari','brave'],
type=str) type=str)
parser.add_argument("--window_size",
help="Window size",
type=str)
parser.add_argument("--proxy_server", parser.add_argument("--proxy_server",
help="overwrite proxy server, format: ip:port", help="overwrite proxy server, format: ip:port",
type=str) type=str)

View File

@ -18,14 +18,13 @@ import base64
import json import json
import os import os
import platform import platform
import subprocess
import sys import sys
import threading import threading
import webbrowser import webbrowser
import util import util
CONST_APP_VERSION = "MaxBot (2024.03.21)" CONST_APP_VERSION = "MaxBot (2024.03.22)"
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json" CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -304,54 +303,8 @@ def btn_items_run_event(event):
btn_index = int(str(event.widget['text']).split(" ")[1]) btn_index = int(str(event.widget['text']).split(" ")[1])
global txt_file_name global txt_file_name
filename=txt_file_name[btn_index-1].get().strip() filename=txt_file_name[btn_index-1].get().strip()
threading.Thread(target=launch_maxbot, args=(filename,)).start() script_name = "chrome_tixcraft"
threading.Thread(target=util.launch_maxbot, args=(script_name,filename,)).start()
def launch_maxbot(filename, homepage="", kktix_account = "", kktix_password=""):
cmd_argument = []
if len(filename) > 0:
cmd_argument.append('--input=' + filename)
if len(homepage) > 0:
cmd_argument.append('--homepage=' + homepage)
if len(kktix_account) > 0:
cmd_argument.append('--kktix_account=' + kktix_account)
if len(kktix_password) > 0:
cmd_argument.append('--kktix_password=' + kktix_password)
working_dir = os.path.dirname(os.path.realpath(__file__))
if hasattr(sys, 'frozen'):
print("execute in frozen mode")
# check platform here.
cmd = './chrome_tixcraft' + ' '.join(cmd_argument)
if platform.system() == 'Darwin':
print("execute MacOS python script")
if platform.system() == 'Linux':
print("execute linux binary")
if platform.system() == 'Windows':
print("execute .exe binary.")
cmd = 'chrome_tixcraft.exe ' + ' '.join(cmd_argument)
subprocess.Popen(cmd, shell=True, cwd=working_dir)
else:
interpreter_binary = 'python'
interpreter_binary_alt = 'python3'
if platform.system() != 'Windows':
interpreter_binary = 'python3'
interpreter_binary_alt = 'python'
print("execute in shell mode.")
script_name = "chrome_tixcraft"
try:
print('try', interpreter_binary)
cmd_array = [interpreter_binary, script_name + '.py'] + cmd_argument
s=subprocess.Popen(cmd_array, cwd=working_dir)
except Exception as exc:
print('try', interpreter_binary_alt)
try:
cmd_array = [interpreter_binary_alt, script_name + '.py'] + cmd_argument
s=subprocess.Popen(cmd_array, cwd=working_dir)
except Exception as exc:
msg=str(exc)
print("exeption:", msg)
pass
def ConfigListTab(root, config_dict, language_code, UI_PADDING_X): def ConfigListTab(root, config_dict, language_code, UI_PADDING_X):

View File

@ -13,7 +13,7 @@ import requests
import util import util
CONST_APP_VERSION = "MaxBot (2024.03.21)" CONST_APP_VERSION = "MaxBot (2024.03.22)"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"

View File

@ -29,7 +29,7 @@ from datetime import datetime
import util import util
CONST_APP_VERSION = "MaxBot (2024.03.21)" CONST_APP_VERSION = "MaxBot (2024.03.22)"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json" CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json"
@ -294,54 +294,8 @@ def btn_items_run_event(event):
btn_index = 1 btn_index = 1
global txt_file_name global txt_file_name
filename=txt_file_name[btn_index-1].get().strip() filename=txt_file_name[btn_index-1].get().strip()
threading.Thread(target=launch_maxbot, args=(filename,)).start() script_name = "chrome_tixcraft"
threading.Thread(target=util.launch_maxbot, args=(script_name,filename,)).start()
def launch_maxbot(filename, homepage="", kktix_account = "", kktix_password=""):
cmd_argument = []
if len(filename) > 0:
cmd_argument.append('--input=' + filename)
if len(homepage) > 0:
cmd_argument.append('--homepage=' + homepage)
if len(kktix_account) > 0:
cmd_argument.append('--kktix_account=' + kktix_account)
if len(kktix_password) > 0:
cmd_argument.append('--kktix_password=' + kktix_password)
working_dir = os.path.dirname(os.path.realpath(__file__))
if hasattr(sys, 'frozen'):
print("execute in frozen mode")
# check platform here.
cmd = './chrome_tixcraft' + ' '.join(cmd_argument)
if platform.system() == 'Darwin':
print("execute MacOS python script")
if platform.system() == 'Linux':
print("execute linux binary")
if platform.system() == 'Windows':
print("execute .exe binary.")
cmd = 'chrome_tixcraft.exe ' + ' '.join(cmd_argument)
subprocess.Popen(cmd, shell=True, cwd=working_dir)
else:
interpreter_binary = 'python'
interpreter_binary_alt = 'python3'
if platform.system() != 'Windows':
interpreter_binary = 'python3'
interpreter_binary_alt = 'python'
print("execute in shell mode.")
script_name = "chrome_tixcraft"
try:
print('try', interpreter_binary)
cmd_array = [interpreter_binary, script_name + '.py'] + cmd_argument
s=subprocess.Popen(cmd_array, cwd=working_dir)
except Exception as exc:
print('try', interpreter_binary_alt)
try:
cmd_array = [interpreter_binary_alt, script_name + '.py'] + cmd_argument
s=subprocess.Popen(cmd_array, cwd=working_dir)
except Exception as exc:
msg=str(exc)
print("exeption:", msg)
pass
def ConfigListTab(root, config_dict, language_code, UI_PADDING_X): def ConfigListTab(root, config_dict, language_code, UI_PADDING_X):
@ -840,9 +794,12 @@ def kktix_status_query(config_dict, last_status, log_file=False):
print(config_dict["ticket_exec_maxbot"]) print(config_dict["ticket_exec_maxbot"])
if config_dict["ticket_exec_maxbot"]: if config_dict["ticket_exec_maxbot"]:
filename=config_dict["list"][btn_index-1] filename=config_dict["list"][btn_index-1]
print("filename", filename) #print("filename", filename)
script_name = "chrome_tixcraft"
if config_dict["advanced"]["webdriver_type"]=="nodriver":
script_name = "nodriver_tixcraft"
if len(filename) > 0: if len(filename) > 0:
threading.Thread(target=launch_maxbot, args=(filename,)).start() threading.Thread(target=util.launch_maxbot, args=(script_name, filename,)).start()
print(config_dict["ticket_exec_command"], config_dict["new_process"]) print(config_dict["ticket_exec_command"], config_dict["new_process"])
if config_dict["ticket_exec_command"]: if config_dict["ticket_exec_command"]:

View File

@ -32,7 +32,7 @@ except Exception as exc:
print(exc) print(exc)
pass pass
CONST_APP_VERSION = "MaxBot (2024.03.21)" CONST_APP_VERSION = "MaxBot (2024.03.22)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -150,6 +150,11 @@ def get_config_dict(args):
if len(args.proxy_server) > 2: if len(args.proxy_server) > 2:
config_dict["advanced"]["proxy_server_port"] = args.proxy_server config_dict["advanced"]["proxy_server_port"] = args.proxy_server
if not args.window_size is None:
if len(args.window_size) > 2:
config_dict["advanced"]["window_size"] = args.window_size
# special case for headless to enable away from keyboard mode. # special case for headless to enable away from keyboard mode.
is_headless_enable_ocr = False is_headless_enable_ocr = False
if config_dict["advanced"]["headless"]: if config_dict["advanced"]["headless"]:
@ -896,7 +901,6 @@ def get_nodriver_browser_args():
"--disable-component-cloud-policy", "--disable-component-cloud-policy",
"--disable-component-update", "--disable-component-update",
"--disable-composited-antialiasing", "--disable-composited-antialiasing",
"--disable-d3d11",
"--disable-default-apps", "--disable-default-apps",
"--disable-dev-shm-usage", "--disable-dev-shm-usage",
"--disable-device-discovery-notifications", "--disable-device-discovery-notifications",
@ -912,7 +916,6 @@ def get_nodriver_browser_args():
"--disable-password-generation", "--disable-password-generation",
"--disable-popup-blocking", "--disable-popup-blocking",
"--disable-renderer-backgrounding", "--disable-renderer-backgrounding",
"--disable-renderer-backgrounding",
"--disable-session-crashed-bubble", "--disable-session-crashed-bubble",
"--disable-smooth-scrolling", "--disable-smooth-scrolling",
"--disable-sync", "--disable-sync",
@ -944,7 +947,8 @@ def get_maxbot_plus_extension_path():
def get_extension_config(config_dict): def get_extension_config(config_dict):
default_lang = "zh-TW" default_lang = "zh-TW"
conf = Config(browser_args=get_nodriver_browser_args(), lang=default_lang, headless=config_dict["advanced"]["headless"]) no_sandbox=True
conf = Config(browser_args=get_nodriver_browser_args(), lang=default_lang, no_sandbox=no_sandbox, headless=config_dict["advanced"]["headless"])
conf.add_extension(get_maxbot_plus_extension_path()) conf.add_extension(get_maxbot_plus_extension_path())
return conf return conf
@ -1003,24 +1007,36 @@ async def nodrver_block_urls(tab, config_dict):
await tab.send(cdp.network.set_blocked_ur_ls(NETWORK_BLOCKED_URLS)) await tab.send(cdp.network.set_blocked_ur_ls(NETWORK_BLOCKED_URLS))
return tab return tab
async def nodriver_resize_window(tab, config_dict):
if len(config_dict["advanced"]["window_size"]) > 0:
if "," in config_dict["advanced"]["window_size"]:
size_array = config_dict["advanced"]["window_size"].split(",")
position_left = 0
if len(size_array) >= 3:
position_left = int(size_array[0]) * int(size_array[2])
#tab = await driver.main_tab()
if tab:
await tab.set_window_size(left=position_left, top=30, width=int(size_array[0]), height=int(size_array[1]))
async def main(args): async def main(args):
config_dict = get_config_dict(args) config_dict = get_config_dict(args)
driver = None driver = None
tab = None tab = None
if not config_dict is None: if not config_dict is None:
sandbox = False
conf = get_extension_config(config_dict) conf = get_extension_config(config_dict)
# PS: nodrirver run twice always cause error:
# Failed to connect to browser
# One of the causes could be when you are running as root.
# In that case you need to pass no_sandbox=True
#driver = await uc.start(conf, sandbox=sandbox, headless=config_dict["advanced"]["headless"])
driver = await uc.start(conf) driver = await uc.start(conf)
if not driver is None: if not driver is None:
tab = await nodriver_goto_homepage(driver, config_dict) tab = await nodriver_goto_homepage(driver, config_dict)
tab = await nodrver_block_urls(tab, config_dict) tab = await nodrver_block_urls(tab, config_dict)
if not config_dict["advanced"]["headless"]: if not config_dict["advanced"]["headless"]:
if len(config_dict["advanced"]["window_size"]) > 0: await nodriver_resize_window(tab, config_dict)
if "," in config_dict["advanced"]["window_size"]:
target_array = config_dict["advanced"]["window_size"].split(",")
#tab = await driver.main_tab()
if tab:
await tab.set_window_size(left=30, top=30, width=int(target_array[0]), height=int(target_array[1]))
else: else:
print("無法使用nodriver程式無法繼續工作") print("無法使用nodriver程式無法繼續工作")
sys.exit() sys.exit()
@ -1177,6 +1193,10 @@ def cli():
choices=['chrome','firefox','edge','safari','brave'], choices=['chrome','firefox','edge','safari','brave'],
type=str) type=str)
parser.add_argument("--window_size",
help="Window size",
type=str)
parser.add_argument("--proxy_server", parser.add_argument("--proxy_server",
help="overwrite proxy server, format: ip:port", help="overwrite proxy server, format: ip:port",
type=str) type=str)

View File

@ -5,6 +5,7 @@ cryptography
ddddocr ddddocr
idna idna
looseversion looseversion
nodriver
numpy numpy
Pillow Pillow
playsound==1.2.2 playsound==1.2.2
@ -13,3 +14,5 @@ selenium
tornado tornado
undetected-chromedriver undetected-chromedriver
urllib3 urllib3
#PS: nodriver need python 3.9+
#

View File

@ -80,7 +80,7 @@
"reset_browser_interval": 0, "reset_browser_interval": 0,
"max_dwell_time": 60, "max_dwell_time": 60,
"proxy_server_port": "", "proxy_server_port": "",
"window_size": "512,1024", "window_size": "480,1024",
"idle_keyword": "", "idle_keyword": "",
"resume_keyword": "", "resume_keyword": "",
"idle_keyword_second": "", "idle_keyword_second": "",

View File

@ -41,7 +41,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.03.21)" CONST_APP_VERSION = "MaxBot (2024.03.22)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -685,7 +685,7 @@ def get_default_config():
config_dict["advanced"]["reset_browser_interval"] = 0 config_dict["advanced"]["reset_browser_interval"] = 0
config_dict["advanced"]["max_dwell_time"] = 60 config_dict["advanced"]["max_dwell_time"] = 60
config_dict["advanced"]["proxy_server_port"] = "" config_dict["advanced"]["proxy_server_port"] = ""
config_dict["advanced"]["window_size"] = "512,1024" config_dict["advanced"]["window_size"] = "480,1024"
config_dict["advanced"]["idle_keyword"] = "" config_dict["advanced"]["idle_keyword"] = ""
config_dict["advanced"]["resume_keyword"] = "" config_dict["advanced"]["resume_keyword"] = ""
@ -755,7 +755,8 @@ def btn_launcher_clicked(language_code):
Root_Dir = "" Root_Dir = ""
save_ret = btn_save_act(slience_mode=True) save_ret = btn_save_act(slience_mode=True)
if save_ret: if save_ret:
run_python_script("config_launcher") script_name = "config_launcher"
threading.Thread(target=util.launch_maxbot, args=(script_name,)).start()
def btn_save_clicked(): def btn_save_clicked():
btn_save_act() btn_save_act()
@ -1114,16 +1115,33 @@ def btn_run_clicked(language_code):
save_ret = btn_save_act(slience_mode=True) save_ret = btn_save_act(slience_mode=True)
print("save config result:", save_ret) print("save config result:", save_ret)
if save_ret: if save_ret:
threading.Thread(target=launch_maxbot).start() launch_maxbot()
def launch_maxbot(): def launch_maxbot():
global launch_counter
if "launch_counter" in globals():
launch_counter += 1
else:
launch_counter = 0
global combo_webdriver_type global combo_webdriver_type
webdriver_type = combo_webdriver_type.get().strip() webdriver_type = combo_webdriver_type.get().strip()
python_script_name = "chrome_tixcraft" script_name = "chrome_tixcraft"
if webdriver_type == CONST_WEBDRIVER_TYPE_NODRIVER: if webdriver_type == CONST_WEBDRIVER_TYPE_NODRIVER:
python_script_name = "nodriver_tixcraft" script_name = "nodriver_tixcraft"
run_python_script(python_script_name)
global txt_window_size
window_size = txt_window_size.get().strip()
if len(window_size) > 0:
if "," in window_size:
size_array = window_size.split(",")
target_width = int(size_array[0])
target_left = launch_counter * launch_counter
if target_left > 1440:
launch_counter = 0
window_size = window_size + "," + str(launch_counter)
threading.Thread(target=util.launch_maxbot, args=(script_name,"","","","",window_size,)).start()
def show_preview_text(): def show_preview_text():
if os.path.exists(CONST_MAXBOT_ANSWER_ONLINE_FILE): if os.path.exists(CONST_MAXBOT_ANSWER_ONLINE_FILE):
@ -1173,42 +1191,6 @@ def btn_preview_text_clicked():
break break
show_preview_text() show_preview_text()
def run_python_script(script_name):
working_dir = os.path.dirname(os.path.realpath(__file__))
cmd_argument = ""
if hasattr(sys, 'frozen'):
print("execute in frozen mode")
cmd = './' + script_name + cmd_argument
# check platform here.
if platform.system() == 'Darwin':
print("execute MacOS python script")
if platform.system() == 'Linux':
print("execute linux binary")
if platform.system() == 'Windows':
print("execute .exe binary.")
cmd = script_name + ".exe" + cmd_argument
subprocess.Popen(cmd, shell=True, cwd=working_dir)
else:
interpreter_binary = 'python'
interpreter_binary_alt = 'python3'
if platform.system() != 'Windows':
interpreter_binary = 'python3'
interpreter_binary_alt = 'python'
print("execute in shell mode.")
cmd = script_name + '.py'
try:
print('try', interpreter_binary)
s=subprocess.Popen([interpreter_binary, cmd], cwd=working_dir)
except Exception as exc:
print('try', interpreter_binary_alt)
try:
s=subprocess.Popen([interpreter_binary_alt, cmd], cwd=working_dir)
except Exception as exc:
msg=str(exc)
print("exeption:", msg)
pass
def btn_open_text_server_clicked(): def btn_open_text_server_clicked():
global tab4 global tab4
@ -3085,11 +3067,11 @@ def main_gui():
load_GUI(root, config_dict) load_GUI(root, config_dict)
GUI_SIZE_WIDTH = 580 GUI_SIZE_WIDTH = 590
GUI_SIZE_HEIGHT = 640 GUI_SIZE_HEIGHT = 645
GUI_SIZE_MACOS = str(GUI_SIZE_WIDTH) + 'x' + str(GUI_SIZE_HEIGHT) 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-70) GUI_SIZE_WINDOWS=str(GUI_SIZE_WIDTH-70) + 'x' + str(GUI_SIZE_HEIGHT-80)
GUI_SIZE =GUI_SIZE_MACOS GUI_SIZE =GUI_SIZE_MACOS

View File

@ -1 +1 @@
{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_sound": {"ticket": true, "order": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "disable_adjacent_seat": false, "hide_some_image": true, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.05, "reset_browser_interval": 0, "max_dwell_time": 60, "proxy_server_port": "", "window_size": "512,1024", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}, "domain_filter": ["*google-analytics.com/*", "*googletagmanager.com/*", "*googletagservices.com/*", "*lndata.com/*", "*a.amnet.tw/*", "*adx.c.appier.net/*", "*clarity.ms/*", "*cloudfront.com/*", "*cms.analytics.yahoo.com/*", "*doubleclick.net/*", "*e2elog.fetnet.net/*", "*fundingchoicesmessages.google.com/*", "*ghtinc.com/*", "*match.adsrvr.org/*", "*onead.onevision.com.tw/*", "*popin.cc/*", "*rollbar.com/*", "*sb.scorecardresearch.com/*", "*tagtoo.co/*", "*.ssp.hinet.net/*", "*ticketmaster.sg/js/adblock*", "*.googlesyndication.com/*", "*treasuredata.com/*", "*play.google.com/log?*", "*www.youtube.com/youtubei/v1/player/heartbeat*", "*tixcraft.com/js/analytics.js*", "*ticketmaster.sg/js/adblock.js*", "*img.uniicreative.com/*", "*cdn.cookielaw.org/*", "*tixcraft.com/js/custom.js*", "*tixcraft.com/js/common.js*", "*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*"]} {"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_sound": {"ticket": true, "order": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "disable_adjacent_seat": false, "hide_some_image": true, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.05, "reset_browser_interval": 0, "max_dwell_time": 60, "proxy_server_port": "", "window_size": "480,1024,1", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}, "domain_filter": ["*google-analytics.com/*", "*googletagmanager.com/*", "*googletagservices.com/*", "*lndata.com/*", "*a.amnet.tw/*", "*adx.c.appier.net/*", "*clarity.ms/*", "*cloudfront.com/*", "*cms.analytics.yahoo.com/*", "*doubleclick.net/*", "*e2elog.fetnet.net/*", "*fundingchoicesmessages.google.com/*", "*ghtinc.com/*", "*match.adsrvr.org/*", "*onead.onevision.com.tw/*", "*popin.cc/*", "*rollbar.com/*", "*sb.scorecardresearch.com/*", "*tagtoo.co/*", "*.ssp.hinet.net/*", "*ticketmaster.sg/js/adblock*", "*.googlesyndication.com/*", "*treasuredata.com/*", "*play.google.com/log?*", "*www.youtube.com/youtubei/v1/player/heartbeat*", "*tixcraft.com/js/analytics.js*", "*ticketmaster.sg/js/adblock.js*", "*img.uniicreative.com/*", "*cdn.cookielaw.org/*", "*tixcraft.com/js/custom.js*", "*tixcraft.com/js/common.js*", "*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*"]}

View File

@ -1 +1 @@
{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_sound": {"ticket": true, "order": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "disable_adjacent_seat": false, "hide_some_image": true, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.05, "reset_browser_interval": 0, "max_dwell_time": 60, "proxy_server_port": "", "window_size": "512,1024", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}} {"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_sound": {"ticket": true, "order": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "disable_adjacent_seat": false, "hide_some_image": true, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.05, "reset_browser_interval": 0, "max_dwell_time": 60, "proxy_server_port": "", "window_size": "480,1024,1", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}}