2024-03-09, add window size to resize window.

master
Your Name 2024-03-25 12:26:45 +08:00
parent 40e9873af4
commit 8067d77dab
8 changed files with 37 additions and 9 deletions

View File

@ -112,7 +112,7 @@ CONST_WEBDRIVER_TYPE_SELENIUM = "selenium"
CONST_WEBDRIVER_TYPE_UC = "undetected_chromedriver"
CONST_WEBDRIVER_TYPE_DP = "DrissionPage"
CONST_CHROME_FAMILY = ["chrome","edge","brave"]
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.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"
warnings.simplefilter('ignore',InsecureRequestWarning)
ssl._create_default_https_context = ssl._create_unverified_context
@ -463,8 +463,8 @@ def get_chrome_options(webdriver_path, config_dict):
if config_dict["advanced"]["headless"]:
#chrome_options.add_argument('--headless')
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("--disable-animations")
chrome_options.add_argument("--disable-blink-features=AutomationControlled")
chrome_options.add_argument("--disable-infobars")
@ -711,8 +711,8 @@ def get_uc_options(uc, config_dict, webdriver_path):
if config_dict["advanced"]["headless"]:
#options.add_argument('--headless')
options.add_argument('--headless=new')
options.add_argument("--user-agent=%s" % (USER_AGENT))
options.add_argument("--user-agent=%s" % (USER_AGENT))
options.add_argument("--disable-animations")
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument("--disable-infobars")
@ -12572,12 +12572,19 @@ def reset_webdriver(driver, config_dict, url):
pass
return new_driver
def resize_window(driver, config_dict):
if len(config_dict["advanced"]["window_size"]) > 0:
if "," in config_dict["advanced"]["window_size"]:
target_array = config_dict["advanced"]["window_size"].split(",")
driver.set_window_size(int(target_array[0]), int(target_array[1]))
def main(args):
config_dict = get_config_dict(args)
driver = None
if not config_dict is None:
driver = get_driver_by_config(config_dict)
resize_window(driver, config_dict)
else:
print("Load config error!")

View File

@ -23,7 +23,7 @@ import sys
import threading
import webbrowser
CONST_APP_VERSION = "MaxBot (2024.03.08)"
CONST_APP_VERSION = "MaxBot (2024.03.09)"
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -29,7 +29,7 @@ from datetime import datetime
import requests
CONST_APP_VERSION = "MaxBot (2024.03.08)"
CONST_APP_VERSION = "MaxBot (2024.03.09)"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json"

View File

@ -79,6 +79,7 @@
"auto_reload_page_interval": 0.1,
"reset_browser_interval": 0.0,
"proxy_server_port": "",
"window_size": "500,1024",
"idle_keyword": "",
"resume_keyword": "",
"idle_keyword_second": "",

View File

@ -50,7 +50,7 @@ try:
except Exception as exc:
pass
CONST_APP_VERSION = "MaxBot (2024.03.08)"
CONST_APP_VERSION = "MaxBot (2024.03.09)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -146,6 +146,7 @@ def load_translate():
en_us["auto_reload_page_interval"] = 'Reload page interval(sec.)'
en_us["reset_browser_interval"] = 'Reset browser interval(sec.)'
en_us["proxy_server_port"] = 'Proxy IP:PORT'
en_us["window_size"] = 'Window size'
en_us["area_select_order"] = 'Area select order'
en_us["area_keyword"] = 'Area Keyword'
@ -263,6 +264,7 @@ def load_translate():
zh_tw["auto_reload_page_interval"] = '自動刷新頁面間隔(秒)'
zh_tw["reset_browser_interval"] = '重新啟動瀏覽器間隔(秒)'
zh_tw["proxy_server_port"] = 'Proxy IP:PORT'
zh_tw["window_size"] = '瀏覽器視窗大小'
zh_tw["area_select_order"] = '區域排序方式'
zh_tw["area_keyword"] = '區域關鍵字'
@ -380,6 +382,7 @@ def load_translate():
zh_cn["auto_reload_page_interval"] = '重新加载间隔(秒)'
zh_cn["reset_browser_interval"] = '重新启动浏览器间隔(秒)'
zh_cn["proxy_server_port"] = 'Proxy IP:PORT'
zh_cn["window_size"] = '浏览器窗口大小'
zh_cn["area_select_order"] = '区域排序方式'
zh_cn["area_keyword"] = '区域关键字'
@ -498,6 +501,7 @@ def load_translate():
ja_jp["auto_reload_page_interval"] = 'リロード間隔(秒)'
ja_jp["reset_browser_interval"] = 'ブラウザの再起動間隔(秒)'
ja_jp["proxy_server_port"] = 'Proxy IP:PORT'
ja_jp["window_size"] = 'ウィンドウサイズ'
ja_jp["area_select_order"] = 'エリアソート方法'
ja_jp["area_keyword"] = 'エリアキーワード'
@ -753,6 +757,7 @@ def get_default_config():
config_dict["advanced"]["auto_reload_page_interval"] = 0.1
config_dict["advanced"]["reset_browser_interval"] = 0
config_dict["advanced"]["proxy_server_port"] = ""
config_dict["advanced"]["window_size"] = "512,520"
config_dict["advanced"]["idle_keyword"] = ""
config_dict["advanced"]["resume_keyword"] = ""
@ -859,6 +864,7 @@ def btn_save_act(slience_mode=False):
global txt_auto_reload_page_interval
global txt_reset_browser_intervalv
global txt_proxy_server_port
global txt_window_size
global txt_tixcraft_sid
global txt_ibon_ibonqware
@ -1144,6 +1150,7 @@ def btn_save_act(slience_mode=False):
config_dict["advanced"]["auto_reload_page_interval"] = float(txt_auto_reload_page_interval.get().strip())
config_dict["advanced"]["reset_browser_interval"] = float(txt_reset_browser_interval.get().strip())
config_dict["advanced"]["proxy_server_port"] = txt_proxy_server_port.get().strip()
config_dict["advanced"]["window_size"] = txt_window_size.get().strip()
if config_dict["advanced"]["reset_browser_interval"] > 0:
if config_dict["advanced"]["reset_browser_interval"] < 20:
@ -1461,6 +1468,7 @@ def applyNewLanguage():
global lbl_auto_reload_page_interval
global lbl_reset_browser_interval
global lbl_proxy_server_port
global lbl_window_size
lbl_homepage.config(text=translate[language_code]["homepage"])
lbl_browser.config(text=translate[language_code]["browser"])
@ -1499,6 +1507,7 @@ def applyNewLanguage():
lbl_auto_reload_page_interval.config(text=translate[language_code]["auto_reload_page_interval"])
lbl_reset_browser_interval.config(text=translate[language_code]["reset_browser_interval"])
lbl_proxy_server_port.config(text=translate[language_code]["proxy_server_port"])
lbl_window_size.config(text=translate[language_code]["window_size"])
lbl_headless.config(text=translate[language_code]["headless"])
lbl_verbose.config(text=translate[language_code]["verbose"])
@ -2165,6 +2174,17 @@ def AdvancedTab(root, config_dict, language_code, UI_PADDING_X):
group_row_count +=1
global lbl_window_size
lbl_window_size = Label(frame_group_header, text=translate[language_code]['window_size'])
lbl_window_size.grid(column=0, row=group_row_count, sticky = E)
global txt_window_size
txt_window_size_value = StringVar(frame_group_header, value=config_dict["advanced"]["window_size"])
txt_window_size = Entry(frame_group_header, width=30, textvariable = txt_window_size_value)
txt_window_size.grid(column=1, row=group_row_count, sticky = W)
group_row_count +=1
global lbl_chrome_extension
lbl_chrome_extension = Label(frame_group_header, text=translate[language_code]['chrome_extension'])
lbl_chrome_extension.grid(column=0, row=group_row_count, sticky = E)
@ -3175,7 +3195,7 @@ def main_gui():
load_GUI(root, config_dict)
GUI_SIZE_WIDTH = 580
GUI_SIZE_HEIGHT = 590
GUI_SIZE_HEIGHT = 610
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)

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.1, "reset_browser_interval": 0.0, "proxy_server_port": "", "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.1, "reset_browser_interval": 0.0, "proxy_server_port": "", "window_size": "500,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/*"]}

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.1, "reset_browser_interval": 0.0, "proxy_server_port": "", "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.1, "reset_browser_interval": 0.0, "proxy_server_port": "", "window_size": "500,1024", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}}