update for kktix/kham/ticket.com.tw

master
Max 2023-11-15 18:11:03 +08:00 committed by GitHub
parent e29529beef
commit a4a16e6de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 52 additions and 27 deletions

View File

@ -55,7 +55,7 @@ import webbrowser
import chromedriver_autoinstaller import chromedriver_autoinstaller
CONST_APP_VERSION = "MaxBot (2023.11.11)" CONST_APP_VERSION = "MaxBot (2023.11.12)"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt" CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
@ -4458,22 +4458,30 @@ def kktix_reg_new_main(driver, config_dict, fail_list, captcha_sound_played, is_
is_need_refresh = False is_need_refresh = False
if len(area_keyword) > 0: if len(area_keyword) > 0:
for retry_index in range(2): area_keyword_array = []
try:
area_keyword_array = json.loads("["+ area_keyword +"]")
except Exception as exc:
area_keyword_array = [] area_keyword_array = []
try:
area_keyword_array = json.loads("["+ area_keyword +"]")
except Exception as exc:
area_keyword_array = []
for area_keyword_item in area_keyword_array: # default refresh
is_ticket_number_assigned, is_need_refresh = kktix_assign_ticket_number(driver, config_dict, area_keyword_item) is_need_refresh_final = True
if is_ticket_number_assigned:
break for area_keyword_item in area_keyword_array:
else: is_ticket_number_assigned, is_need_refresh_tmp = kktix_assign_ticket_number(driver, config_dict, area_keyword_item)
print("is_need_refresh for keyword:", area_keyword_item)
# one of keywords not need to refresh, final is not refresh.
if not is_need_refresh_tmp:
is_need_refresh_final = False
if is_ticket_number_assigned: if is_ticket_number_assigned:
break break
else:
if show_debug_message:
print("is_need_refresh for keyword:", area_keyword_item)
if not is_ticket_number_assigned:
is_need_refresh = is_need_refresh_final
else: else:
# empty keyword, match all. # empty keyword, match all.
is_ticket_number_assigned, is_need_refresh = kktix_assign_ticket_number(driver, config_dict, "") is_ticket_number_assigned, is_need_refresh = kktix_assign_ticket_number(driver, config_dict, "")
@ -9636,6 +9644,11 @@ def hkam_date_auto_select(driver, domain_name, config_dict):
if reset_row_text_if_match_keyword_exclude(config_dict, row_text): if reset_row_text_if_match_keyword_exclude(config_dict, row_text):
row_text = "" row_text = ""
if len(row_text) > 0:
if "<button" in row_html:
if ' disabled">' in row_html:
row_text = ""
if len(row_text) > 0: if len(row_text) > 0:
if "<button" in row_html: if "<button" in row_html:
buyable = False buyable = False
@ -9648,6 +9661,25 @@ def hkam_date_auto_select(driver, domain_name, config_dict):
else: else:
row_text = "" row_text = ""
if len(row_text) > 0:
# kham.
price_disabled_html = '"lightblue"'
if 'ticket.com' in domain_name:
price_disabled_html = '<del>'
if "<td" in row_html:
td_array = row_html.split("<td")
if len(td_array) > 3:
td_target = "<td" + td_array[3]
price_array = td_target.split("")
is_all_priece_disabled = True
for each_price in price_array:
if not (price_disabled_html in each_price):
is_all_priece_disabled = False
if is_all_priece_disabled:
row_text = ""
if len(row_text) > 0: if len(row_text) > 0:
formated_area_list.append(row) formated_area_list.append(row)
else: else:
@ -9978,25 +10010,18 @@ def ticket_performance_ticket_number(driver, config_dict):
inputed_value = "" inputed_value = ""
if inputed_value == "" or inputed_value == "0": if inputed_value == "" or inputed_value == "0":
is_visible = False
try: try:
if form_input.is_enabled(): form_input.click()
is_visible = True form_input.clear()
form_input.send_keys(str(ticket_number))
is_ticket_number_assigned = True
except Exception as exc: except Exception as exc:
pass if show_debug_message:
print(exc)
if is_visible:
try: try:
form_input.click() driver.execute_script("arguments[0].value='"+ str(ticket_number) +"';", form_input)
form_input.clear()
form_input.send_keys(str(ticket_number))
is_ticket_number_assigned = True
except Exception as exc: except Exception as exc:
try: pass
driver.execute_script("arguments[0].value='"+ str(ticket_number) +"'';", form_input)
ret = True
except Exception as exc:
pass
if len(inputed_value) > 0: if len(inputed_value) > 0:
if not inputed_value=="0": if not inputed_value=="0":