Skip to content

Commit

Permalink
2024-04-12, update for kktix bus ticket.
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Apr 26, 2024
1 parent 1ac2c8a commit 0c7d384
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 31 deletions.
47 changes: 20 additions & 27 deletions chrome_tixcraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
print(exc)
pass

CONST_APP_VERSION = "MaxBot (2024.04.11)"
CONST_APP_VERSION = "MaxBot (2024.04.12)"

CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down Expand Up @@ -2422,25 +2422,30 @@ def kktix_press_next_button(driver):
button_count = len(but_button_list)
#print("button_count:",button_count)
if button_count > 0:
btn = but_button_list[button_count-1]
try:
#print("click on last button:", button_count)
but_button_list[button_count-1].click()
time.sleep(0.3)
driver.set_script_timeout(0.1)
driver.execute_script("arguments[0].focus();", btn)
ret = True
except Exception as exc:
print(exc)
pass
for retry_idx in range(4):
try:
#print("click on last button:", button_count)
btn.click()
time.sleep(0.2)
ret = True
except Exception as exc:
print(exc)
pass
if ret:
break

return ret


def kktix_travel_price_list(driver, config_dict, kktix_area_auto_select_mode, kktix_area_keyword):
show_debug_message = True # debug.
show_debug_message = False # online

if config_dict["advanced"]["verbose"]:
show_debug_message = True

show_debug_message = config_dict["advanced"]["verbose"]:
ticket_number = config_dict["ticket_number"]

areas = None
Expand Down Expand Up @@ -2645,11 +2650,7 @@ def kktix_travel_price_list(driver, config_dict, kktix_area_auto_select_mode, kk
return is_dom_ready, is_ticket_number_assigned, areas

def kktix_assign_ticket_number(driver, config_dict, kktix_area_keyword):
show_debug_message = True # debug.
show_debug_message = False # online

if config_dict["advanced"]["verbose"]:
show_debug_message = True
show_debug_message = config_dict["advanced"]["verbose"]:

ticket_number_str = str(config_dict["ticket_number"])
auto_select_mode = config_dict["area_auto_select"]["mode"]
Expand Down Expand Up @@ -2708,11 +2709,7 @@ def kktix_assign_ticket_number(driver, config_dict, kktix_area_keyword):


def kktix_check_agree_checkbox(driver, config_dict):
show_debug_message = True # debug.
show_debug_message = False # online

if config_dict["advanced"]["verbose"]:
show_debug_message = True
show_debug_message = config_dict["advanced"]["verbose"]:

is_finish_checkbox_click = False
is_dom_ready = False
Expand Down Expand Up @@ -2833,11 +2830,7 @@ def set_kktix_control_label_text(driver, config_dict):


def kktix_reg_captcha(driver, config_dict, fail_list, registrationsNewApp_div):
show_debug_message = True # debug.
show_debug_message = False # online

if config_dict["advanced"]["verbose"]:
show_debug_message = True
show_debug_message = config_dict["advanced"]["verbose"]:

answer_list = []

Expand Down Expand Up @@ -2876,7 +2869,7 @@ def kktix_reg_captcha(driver, config_dict, fail_list, registrationsNewApp_div):

# due multi next buttons(pick seats/best seats)
kktix_press_next_button(driver)
time.sleep(0.75)
time.sleep(0.5)

fail_list.append(inferred_answer_string)
#print("new fail_list:", fail_list)
Expand Down
2 changes: 1 addition & 1 deletion config_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import util

CONST_APP_VERSION = "MaxBot (2024.04.11)"
CONST_APP_VERSION = "MaxBot (2024.04.12)"

CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down
2 changes: 1 addition & 1 deletion nodriver_tixcraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
print(exc)
pass

CONST_APP_VERSION = "MaxBot (2024.04.11)"
CONST_APP_VERSION = "MaxBot (2024.04.12)"

CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down
4 changes: 2 additions & 2 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
except Exception as exc:
pass

CONST_APP_VERSION = "MaxBot (2024.04.11)"
CONST_APP_VERSION = "MaxBot (2024.04.12)"

CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down Expand Up @@ -670,7 +670,7 @@ def get_default_config():
config_dict["advanced"]["user_guess_string"] = ""
config_dict["advanced"]["remote_url"] = "http://127.0.0.1:%d/" % (CONST_SERVER_PORT)

config_dict["advanced"]["auto_reload_page_interval"] = 0.2
config_dict["advanced"]["auto_reload_page_interval"] = 0.1
config_dict["advanced"]["reset_browser_interval"] = 0
config_dict["advanced"]["kktix_status_api"] = False
config_dict["advanced"]["max_dwell_time"] = 60
Expand Down

0 comments on commit 0c7d384

Please sign in to comment.