2024-03-22

master
Max 2024-04-04 20:23:42 +08:00
parent d827ee932a
commit 7fd633c1c0
5 changed files with 40 additions and 22 deletions

View File

@ -10858,8 +10858,12 @@ def reset_webdriver(driver, config_dict, url):
def resize_window(driver, config_dict): def resize_window(driver, config_dict):
if len(config_dict["advanced"]["window_size"]) > 0: if len(config_dict["advanced"]["window_size"]) > 0:
if "," in config_dict["advanced"]["window_size"]: if "," in config_dict["advanced"]["window_size"]:
target_array = config_dict["advanced"]["window_size"].split(",") size_array = config_dict["advanced"]["window_size"].split(",")
driver.set_window_size(int(target_array[0]), int(target_array[1])) position_left = 0
if len(size_array) >= 3:
position_left = int(size_array[0]) * int(size_array[2])
driver.set_window_size(int(size_array[0]), int(size_array[1]))
driver.set_window_position(position_left, 30)
def launch_maxbot(filename, homepage="", kktix_account = "", kktix_password="", headless="", script_name="chrome_tixcraft"): def launch_maxbot(filename, homepage="", kktix_account = "", kktix_password="", headless="", script_name="chrome_tixcraft"):
cmd_argument = [] cmd_argument = []

View File

@ -1018,6 +1018,25 @@ async def nodriver_resize_window(tab, config_dict):
if tab: if tab:
await tab.set_window_size(left=position_left, top=30, width=int(size_array[0]), height=int(size_array[1])) await tab.set_window_size(left=position_left, top=30, width=int(size_array[0]), height=int(size_array[1]))
async def nodriver_current_url(tab):
url = ""
if tab:
url_dict = {}
try:
url_dict = await tab.js_dumps('window.location.href')
except Exception as exc:
print(exc)
pass
url_array = []
if url_dict:
for k in url_dict:
if k.isnumeric():
if "0" in url_dict[k]:
url_array.append(url_dict[k]["0"])
url = ''.join(url_array)
return url
async def main(args): async def main(args):
config_dict = get_config_dict(args) config_dict = get_config_dict(args)
@ -1106,19 +1125,7 @@ async def main(args):
print("nodriver not accessible!") print("nodriver not accessible!")
break break
x_window = None url = await nodriver_current_url(tab)
try:
x_window = await tab.js_dumps('window')
except Exception as exc:
print(exc)
pass
url = None
if x_window:
if "location" in x_window:
if "href" in x_window["location"]:
url = x_window["location"]["href"]
if url is None: if url is None:
continue continue
else: else:

View File

@ -1136,10 +1136,12 @@ def launch_maxbot():
if "," in window_size: if "," in window_size:
size_array = window_size.split(",") size_array = window_size.split(",")
target_width = int(size_array[0]) target_width = int(size_array[0])
target_left = launch_counter * launch_counter target_left = target_width * launch_counter
if target_left > 1440: #print("target_left:", target_left)
if target_left >= 1440:
launch_counter = 0 launch_counter = 0
window_size = window_size + "," + str(launch_counter) window_size = window_size + "," + str(launch_counter)
#print("window_size:", window_size)
threading.Thread(target=util.launch_maxbot, args=(script_name,"","","","",window_size,)).start() threading.Thread(target=util.launch_maxbot, args=(script_name,"","","","",window_size,)).start()

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": "480,1024,1", "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,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}}

View File

@ -82,7 +82,7 @@ function kktix_ajax_return_base_info(base_info, register_info)
function kktix_ajax_return_register_info(register_info) function kktix_ajax_return_register_info(register_info)
{ {
let reload=false; let reload=false;
console.log(register_info.inventory.registerStatus); //console.log(register_info.inventory.registerStatus);
// IN_STOCK // IN_STOCK
if(register_info.inventory.registerStatus=='OUT_OF_STOCK') {reload=true;} if(register_info.inventory.registerStatus=='OUT_OF_STOCK') {reload=true;}
if(register_info.inventory.registerStatus=='COMING_SOON') {reload=true;} if(register_info.inventory.registerStatus=='COMING_SOON') {reload=true;}
@ -95,11 +95,16 @@ function kktix_ajax_return_register_info(register_info)
} }
const rootElement = document.documentElement; const rootElement = document.documentElement;
rootElement.remove(); rootElement.remove();
/*
$('*').bind('blur change click dblclick error focus focusin focusout hover keydown keypress keyup load mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup resize scroll select submit', function(event){
event.stopPropagation();
});
*/
if(auto_reload_page_interval == 0) { if(auto_reload_page_interval == 0) {
//console.log('Start to reload now.'); //console.log('Start to reload now.');
location.reload(); location.reload();
} else { } else {
console.log('We are going to reload after few seconeds.'); //console.log('We are going to reload after few seconeds.');
setTimeout(function () { setTimeout(function () {
location.reload(); location.reload();
}, auto_reload_page_interval * 1000); }, auto_reload_page_interval * 1000);
@ -170,7 +175,7 @@ function kktix_force_auto_reload_by_timer()
if(max_dwell_time <= 10) { if(max_dwell_time <= 10) {
max_dwell_time = 10; max_dwell_time = 10;
} }
console.log('We are going to reload after few seconeds.'); //console.log('We are going to reload after few seconeds.');
setTimeout(function () { setTimeout(function () {
location.reload(); location.reload();
}, max_dwell_time * 1000); }, max_dwell_time * 1000);
@ -193,6 +198,6 @@ storage.get('status', function (items)
kktix_event_register_info(); kktix_event_register_info();
kktix_force_auto_reload_by_timer(); kktix_force_auto_reload_by_timer();
} else { } else {
console.log('maxbot status is not ON'); //console.log('maxbot status is not ON');
} }
}); });