update to 2023-11-09

master
Max 2023-11-10 15:28:50 +08:00 committed by GitHub
parent d5e6fd8fb8
commit d6729a546b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 584 additions and 585 deletions

View File

@ -55,7 +55,7 @@ import webbrowser
import chromedriver_autoinstaller import chromedriver_autoinstaller
CONST_APP_VERSION = "MaxBot (2023.11.08)" CONST_APP_VERSION = "MaxBot (2023.11.09)"
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"
@ -1583,21 +1583,30 @@ def force_press_button_iframe(driver, f, select_by, select_query, force_submit=T
return is_clicked return is_clicked
def remove_attribute_tag_by_selector(driver, select_query, class_name, more_script = ""):
element_script = "eachItem.removeAttribute('"+ class_name +"');"
javascript_tag_by_selector(driver, select_query, element_script, more_script = more_script)
def remove_class_tag_by_selector(driver, select_query, class_name, more_script = ""):
element_script = "eachItem.classList.remove('"+ class_name +"');"
javascript_tag_by_selector(driver, select_query, element_script, more_script = more_script)
def hide_tag_by_selector(driver, select_query, more_script = ""): def hide_tag_by_selector(driver, select_query, more_script = ""):
callback = "eachItem.style='display:none;';" element_script = "eachItem.style='display:none;';"
javascript_tag_by_selector(driver, select_query, callback, more_script = more_script) javascript_tag_by_selector(driver, select_query, element_script, more_script = more_script)
def clean_tag_by_selector(driver, select_query, more_script = ""): def clean_tag_by_selector(driver, select_query, more_script = ""):
callback = "eachItem.outerHTML='';" element_script = "eachItem.outerHTML='';"
javascript_tag_by_selector(driver, select_query, callback, more_script = more_script) javascript_tag_by_selector(driver, select_query, element_script, more_script = more_script)
def javascript_tag_by_selector(driver, select_query, callback, more_script = ""): # PS: selector query string must without single quota.
def javascript_tag_by_selector(driver, select_query, element_script, more_script = ""):
try: try:
driver.set_script_timeout(1) driver.set_script_timeout(1)
js = """var selectSoldoutItems = document.querySelectorAll('%s'); js = """var selectSoldoutItems = document.querySelectorAll('%s');
selectSoldoutItems.forEach((eachItem) => selectSoldoutItems.forEach((eachItem) =>
{%s}); {%s});
%s""" % (select_query, callback, more_script) %s""" % (select_query, element_script, more_script)
#print("javascript:", js) #print("javascript:", js)
driver.execute_script(js) driver.execute_script(js)
@ -1794,25 +1803,23 @@ def tixcraft_date_auto_select(driver, url, config_dict, domain_name):
row_index = 0 row_index = 0
for row in area_list: for row in area_list:
row_index += 1 row_index += 1
row_is_enabled=True
try:
row_text = "" row_text = ""
row_html = "" row_html = ""
# check buy button. try:
if row_is_enabled:
#row_text = row.text #row_text = row.text
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc:
if show_debug_message:
print(exc)
# error, exit loop
break
if len(row_text) > 0: if len(row_text) > 0:
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 = ""
row_is_enabled=False
if len(row_text) > 0: if len(row_text) > 0:
row_is_enabled=True
if row_is_enabled:
row_is_enabled=False row_is_enabled=False
for text_item in find_ticket_text_list: for text_item in find_ticket_text_list:
if text_item in row_text: if text_item in row_text:
@ -1846,11 +1853,6 @@ def tixcraft_date_auto_select(driver, url, config_dict, domain_name):
is_coming_soon = True is_coming_soon = True
break break
except Exception as exc:
if show_debug_message:
print(exc)
pass
if row_is_enabled: if row_is_enabled:
formated_area_list.append(row) formated_area_list.append(row)
@ -1956,19 +1958,19 @@ def ticketmaster_date_auto_select(driver, url, config_dict, domain_name):
row_index = 0 row_index = 0
for row in area_list: for row in area_list:
row_index += 1 row_index += 1
row_is_enabled=True
try:
if not row.is_enabled():
row_is_enabled=False
row_text = "" row_text = ""
row_html = "" row_html = ""
# check buy button. try:
if row_is_enabled:
#row_text = row.text #row_text = row.text
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc:
if show_debug_message:
print(exc)
# error, exit loop
break
if len(row_text) > 0:
row_is_enabled=False row_is_enabled=False
# must contains 'See Tickets' # must contains 'See Tickets'
for text_item in find_ticket_text_list: for text_item in find_ticket_text_list:
@ -1986,11 +1988,6 @@ def ticketmaster_date_auto_select(driver, url, config_dict, domain_name):
print("match sold out text: %s, skip this row." % (sold_out_item)) print("match sold out text: %s, skip this row." % (sold_out_item))
break break
except Exception as exc:
if show_debug_message:
print(exc)
pass
if row_is_enabled: if row_is_enabled:
formated_area_list.append(row) formated_area_list.append(row)
@ -2064,7 +2061,10 @@ def get_matched_blocks_by_keyword_item_set(config_dict, auto_select_mode, keywor
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
pass if show_debug_message:
print(exc)
# error, exit loop
break
if len(row_text) > 0: if len(row_text) > 0:
if reset_row_text_if_match_keyword_exclude(config_dict, row_text): if reset_row_text_if_match_keyword_exclude(config_dict, row_text):
@ -2186,20 +2186,16 @@ def get_tixcraft_target_area(el, config_dict, area_keyword_item):
if area_list_count > 0: if area_list_count > 0:
matched_blocks = [] matched_blocks = []
for row in area_list: for row in area_list:
row_is_enabled=False
try:
row_is_enabled = row.is_enabled()
except Exception as exc:
pass
row_text = "" row_text = ""
row_html = "" row_html = ""
if row_is_enabled:
try: try:
#row_text = row.text #row_text = row.text
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0: if len(row_text) > 0:
@ -3103,20 +3099,16 @@ def get_tixcraft_ticket_select_by_keyword(driver, config_dict, area_keyword_item
if area_list_count > 0: if area_list_count > 0:
matched_blocks = [] matched_blocks = []
for row in area_list: for row in area_list:
row_is_enabled=False
try:
row_is_enabled = row.is_enabled()
except Exception as exc:
pass
row_text = "" row_text = ""
row_html = "" row_html = ""
if row_is_enabled:
try: try:
#row_text = row.text #row_text = row.text
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0: if len(row_text) > 0:
@ -3448,7 +3440,7 @@ def kktix_travel_price_list(driver, config_dict, kktix_area_auto_select_mode, kk
ticket_price_list = None ticket_price_list = None
try: try:
ticket_price_list = driver.find_elements(By.CSS_SELECTOR, '.display-table-row') ticket_price_list = driver.find_elements(By.CSS_SELECTOR, 'div.display-table-row')
except Exception as exc: except Exception as exc:
ticket_price_list = None ticket_price_list = None
print("find ticket-price span Exception:") print("find ticket-price span Exception:")
@ -3485,7 +3477,6 @@ def kktix_travel_price_list(driver, config_dict, kktix_area_auto_select_mode, kk
row_index = 0 row_index = 0
for row in ticket_price_list: for row in ticket_price_list:
row_index += 1 row_index += 1
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -3494,7 +3485,17 @@ def kktix_travel_price_list(driver, config_dict, kktix_area_auto_select_mode, kk
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
is_travel_interrupted = True is_travel_interrupted = True
print("get text fail.") if show_debug_message:
print(exc)
# error, exit loop
break
if len(row_text) > 0:
if '未開賣' in row_text:
row_text = ""
if '暫無票' in row_text:
row_text = ""
if '已售完' in row_text: if '已售完' in row_text:
row_text = "" row_text = ""
@ -3654,12 +3655,17 @@ def kktix_assign_ticket_number(driver, config_dict, kktix_area_keyword):
matched_blocks = None matched_blocks = None
is_ticket_number_assigned, matched_blocks = kktix_travel_price_list(driver, config_dict, auto_select_mode, kktix_area_keyword) is_ticket_number_assigned, matched_blocks = kktix_travel_price_list(driver, config_dict, auto_select_mode, kktix_area_keyword)
is_need_refresh = False
target_area = None target_area = None
if not is_ticket_number_assigned: if not is_ticket_number_assigned:
target_area = get_target_item_from_matched_list(matched_blocks, auto_select_mode) target_area = get_target_item_from_matched_list(matched_blocks, auto_select_mode)
is_need_refresh = False
if not matched_blocks is None:
if len(matched_blocks) == 0:
is_need_refresh = True
if show_debug_message:
print("matched_blocks is empty, is_need_refresh")
current_ticket_number = "" current_ticket_number = ""
is_visible = False is_visible = False
if not target_area is None: if not target_area is None:
@ -4609,11 +4615,8 @@ def get_fami_target_area(driver, config_dict, area_keyword_item):
row_index = 0 row_index = 0
for row in formated_area_list: for row in formated_area_list:
row_index += 1 row_index += 1
#print("row index:", row_index)
date_html_text = "" date_html_text = ""
area_html_text = "" area_html_text = ""
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -4633,7 +4636,9 @@ def get_fami_target_area(driver, config_dict, area_keyword_item):
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
print("get row text fail") if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0: if len(row_text) > 0:
@ -4805,8 +4810,6 @@ def fami_date_auto_select(driver, config_dict, last_activity_url):
row_index = 0 row_index = 0
for row in area_list: for row in area_list:
row_index += 1 row_index += 1
row_is_enabled=False
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -4814,15 +4817,19 @@ def fami_date_auto_select(driver, config_dict, last_activity_url):
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
print("get text fail") if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0: if len(row_text) > 0:
if "<button" in row_html: if "<button" in row_html:
if "立即購買" in row_html: if not("立即購買" in row_html):
row_is_enabled=True row_text = ""
else:
row_text = ""
if row_is_enabled: if len(row_text) > 0:
formated_area_list.append(row) formated_area_list.append(row)
if not formated_area_list is None: if not formated_area_list is None:
@ -4933,17 +4940,17 @@ def fami_area_auto_select(driver, config_dict, area_keyword_item):
row_index = 0 row_index = 0
for row in area_list: for row in area_list:
row_index += 1 row_index += 1
row_is_enabled=True
row_text = "" row_text = ""
row_html = "" row_html = ""
if row_is_enabled:
try: try:
#row_text = row.text #row_text = row.text
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
pass if show_debug_message:
print(exc)
# error, exit loop
break
if '售完' in row_text: if '售完' in row_text:
row_text = "" row_text = ""
@ -4955,10 +4962,7 @@ def fami_area_auto_select(driver, config_dict, area_keyword_item):
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 row_text == "": if len(row_text) > 0:
row_is_enabled=False
if row_is_enabled:
formated_area_list.append(row) formated_area_list.append(row)
else: else:
if show_debug_message: if show_debug_message:
@ -4985,8 +4989,6 @@ def fami_area_auto_select(driver, config_dict, area_keyword_item):
row_index = 0 row_index = 0
for row in formated_area_list: for row in formated_area_list:
row_index += 1 row_index += 1
row_is_enabled=True
if row_is_enabled:
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -4994,7 +4996,9 @@ def fami_area_auto_select(driver, config_dict, area_keyword_item):
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
print("get text fail") if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0: if len(row_text) > 0:
@ -5323,9 +5327,6 @@ def urbtix_date_auto_select(driver, auto_select_mode, date_keyword, auto_reload_
row_index = 0 row_index = 0
for row in formated_area_list: for row in formated_area_list:
row_index += 1 row_index += 1
#row_is_enabled=False
row_is_enabled=True
if row_is_enabled:
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -5333,7 +5334,9 @@ def urbtix_date_auto_select(driver, auto_select_mode, date_keyword, auto_reload_
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
print("get text fail") if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0: if len(row_text) > 0:
@ -5455,45 +5458,35 @@ def urbtix_area_auto_select(driver, config_dict, area_keyword_item):
row_index = 0 row_index = 0
for row in area_list: for row in area_list:
row_index += 1 row_index += 1
row_is_enabled=True
row_text = "" row_text = ""
row_html = "" row_html = ""
if row_is_enabled:
try: try:
#row_text = row.text #row_text = row.text
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
pass if show_debug_message:
print(exc)
# error, exit loop
break
if len(row_text) > 0: if len(row_text) > 0:
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 row_text == "": if len(row_text) > 0:
row_is_enabled=False if 'disabled' in row_html:
row_text = ""
button_class_string = None if len(row_text) > 0:
if row_is_enabled: if 'selected' in row_html:
try:
button_class_string = str(row.get_attribute('class'))
except Exception as exc:
pass
if button_class_string is None:
button_class_string = ""
if len(button_class_string) > 1:
if 'disabled' in button_class_string:
row_is_enabled=False
if 'selected' in button_class_string:
# someone is selected. skip this process. # someone is selected. skip this process.
row_is_enabled=False
is_price_assign_by_bot = True is_price_assign_by_bot = True
row_text = ""
break break
if row_is_enabled: if len(row_text) > 0:
formated_area_list.append(row) formated_area_list.append(row)
else: else:
if show_debug_message: if show_debug_message:
@ -5521,9 +5514,6 @@ def urbtix_area_auto_select(driver, config_dict, area_keyword_item):
row_index = 0 row_index = 0
for row in formated_area_list: for row in formated_area_list:
row_index += 1 row_index += 1
row_is_enabled=True
if row_is_enabled:
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -5531,7 +5521,9 @@ def urbtix_area_auto_select(driver, config_dict, area_keyword_item):
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
print("get text fail") if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0: if len(row_text) > 0:
@ -5871,9 +5863,6 @@ def cityline_date_auto_select(driver, auto_select_mode, date_keyword, auto_reloa
row_index = 0 row_index = 0
for row in formated_area_list: for row in formated_area_list:
row_index += 1 row_index += 1
#row_is_enabled=False
row_is_enabled=True
if row_is_enabled:
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -5881,7 +5870,9 @@ def cityline_date_auto_select(driver, auto_select_mode, date_keyword, auto_reloa
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
print("get text fail") if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0: if len(row_text) > 0:
@ -6011,9 +6002,7 @@ def cityline_area_auto_select(driver, config_dict, area_keyword_item):
row_index = 0 row_index = 0
for row in formated_area_list: for row in formated_area_list:
row_index += 1 row_index += 1
#row_is_enabled=False
row_is_enabled=True
if row_is_enabled:
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -6021,7 +6010,9 @@ def cityline_area_auto_select(driver, config_dict, area_keyword_item):
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
print("get text fail") if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0: if len(row_text) > 0:
@ -6475,18 +6466,20 @@ def ibon_area_auto_select(driver, config_dict, area_keyword_item):
row_index = 0 row_index = 0
for row in area_list: for row in area_list:
row_index += 1 row_index += 1
row_is_enabled=True
row_text = "" row_text = ""
row_html = "" row_html = ""
if row_is_enabled:
try: try:
#row_text = row.text #row_text = row.text
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
pass if show_debug_message:
print(exc)
# error, exit loop
break
if len(row_text) > 0:
if '已售完' in row_text: if '已售完' in row_text:
row_text = "" row_text = ""
@ -6540,10 +6533,7 @@ def ibon_area_auto_select(driver, config_dict, area_keyword_item):
print(exc) print(exc)
pass pass
if row_text == "": if len(row_text) > 0:
row_is_enabled=False
if row_is_enabled:
formated_area_list.append(row) formated_area_list.append(row)
else: else:
if show_debug_message: if show_debug_message:
@ -6570,8 +6560,7 @@ def ibon_area_auto_select(driver, config_dict, area_keyword_item):
row_index = 0 row_index = 0
for row in formated_area_list: for row in formated_area_list:
row_index += 1 row_index += 1
row_is_enabled=True
if row_is_enabled:
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -6579,7 +6568,9 @@ def ibon_area_auto_select(driver, config_dict, area_keyword_item):
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
print("get text fail") if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0: if len(row_text) > 0:
@ -7489,6 +7480,29 @@ def tixcraft_main(driver, url, config_dict, tixcraft_dict, ocr, Captcha_Browser)
return tixcraft_dict return tixcraft_dict
def kktix_paused_main(driver, url, config_dict, kktix_dict):
if '/registrations/new' in url:
# part 1: check recaptch div.
recaptcha_div = None
try:
recaptcha_div = driver.find_element(By.CSS_SELECTOR, '.event-captcha-info')
except Exception as exc:
pass
if not recaptcha_div is None:
select_query = '.ng-hide'
class_name = 'ng-hide'
remove_class_tag_by_selector(driver, select_query, class_name)
select_query = '.btn-disabled-alt'
class_name = 'btn-disabled-alt'
remove_class_tag_by_selector(driver, select_query, class_name)
select_query = 'button[disabled="disabled"]'
class_name = 'disabled'
remove_attribute_tag_by_selector(driver, select_query, class_name)
return kktix_dict
def kktix_main(driver, url, config_dict, kktix_dict): def kktix_main(driver, url, config_dict, kktix_dict):
kktix_account = config_dict["advanced"]["kktix_account"] kktix_account = config_dict["advanced"]["kktix_account"]
@ -7501,6 +7515,8 @@ def kktix_main(driver, url, config_dict, kktix_dict):
if not is_url_contain_sign_in: if not is_url_contain_sign_in:
if '/registrations/new' in url: if '/registrations/new' in url:
is_need_refresh = False
is_finish_checkbox_click = False
is_need_refresh, is_finish_checkbox_click = kktix_reg_auto_reload(driver, url, config_dict, kktix_dict["kktix_register_status_last"]) is_need_refresh, is_finish_checkbox_click = kktix_reg_auto_reload(driver, url, config_dict, kktix_dict["kktix_register_status_last"])
if is_need_refresh: if is_need_refresh:
@ -8772,40 +8788,35 @@ def hkticketing_date_assign(driver, config_dict):
row_index = 0 row_index = 0
for row in area_list: for row in area_list:
row_index += 1 row_index += 1
row_is_enabled=False row_text = ""
option_value_string = None row_html = ""
try: try:
if row.is_enabled(): #row_text = row.text
''' row_html = row.get_attribute('innerHTML')
option_value_string = str(row.get_attribute('value')) row_text = remove_html_tags(row_html)
if len(option_value_string) > 6:
row_is_enabled=True
'''
# alway disable.
row_text = remove_html_tags(row.get_attribute('innerHTML'))
option_text_string = row_text
print("option_text_string:", option_text_string)
if '20' in option_text_string:
row_is_enabled=True
if ' Exhausted' in option_text_string:
row_is_enabled=False
if '配售完畢' in option_text_string:
row_is_enabled=False
if '配售完毕' in option_text_string:
row_is_enabled=False
if 'No Longer On Sale' in option_text_string:
row_is_enabled=False
if '已停止發售' in option_text_string:
row_is_enabled=False
if '已停止发售' in option_text_string:
row_is_enabled=False
except Exception as exc: except Exception as exc:
if show_debug_message: if show_debug_message:
print(exc) print(exc)
pass # error, exit loop
break
if row_is_enabled: if len(row_text) > 0:
if '20' in row_text:
row_text = ""
if ' Exhausted' in row_text:
row_text = ""
if '配售完畢' in row_text:
row_text = ""
if '配售完毕' in row_text:
row_text = ""
if 'No Longer On Sale' in row_text:
row_text = ""
if '已停止發售' in row_text:
row_text = ""
if '已停止发售' in row_text:
row_text = ""
if len(row_text) > 0:
formated_area_list.append(row) formated_area_list.append(row)
if not formated_area_list is None: if not formated_area_list is None:
@ -9064,8 +9075,6 @@ def hkticketing_area_auto_select(driver, config_dict, area_keyword_item):
row_index = 0 row_index = 0
for row in formated_area_list: for row in formated_area_list:
row_index += 1 row_index += 1
row_is_enabled=True
if row_is_enabled:
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -9073,7 +9082,9 @@ def hkticketing_area_auto_select(driver, config_dict, area_keyword_item):
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
print("get text fail") if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0: if len(row_text) > 0:
@ -9663,9 +9674,6 @@ def hkam_date_auto_select(driver, domain_name, config_dict):
row_index = 0 row_index = 0
for row in area_list: for row in area_list:
row_index += 1 row_index += 1
row_is_enabled=False
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -9673,17 +9681,21 @@ def hkam_date_auto_select(driver, domain_name, config_dict):
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
pass if show_debug_message:
print(exc)
# error, exit loop
break
if len(row_text) > 0: if len(row_text) > 0:
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 '立即訂購' in row_text or '點此購票' in row_text: if '立即訂購' in row_text or '點此購票' in row_text:
if "<button" in row_html: if "<button" in row_html:
row_is_enabled=True row_text = ""
if row_is_enabled: if len(row_text) > 0:
formated_area_list.append(row) formated_area_list.append(row)
else: else:
if show_debug_message: if show_debug_message:
@ -9845,8 +9857,6 @@ def kham_area_auto_select(driver, domain_name, config_dict, area_keyword_item):
row_index = 0 row_index = 0
for row in formated_area_list: for row in formated_area_list:
row_index += 1 row_index += 1
row_is_enabled=True
if row_is_enabled:
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -9854,12 +9864,14 @@ def kham_area_auto_select(driver, domain_name, config_dict, area_keyword_item):
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0:
if '售完' in row_text: if '售完' in row_text:
row_text = "" row_text = ""
if len(row_text) > 0:
if ' Soldout' in row_html: if ' Soldout' in row_html:
row_text = "" row_text = ""
@ -10701,32 +10713,23 @@ def ticketplus_date_auto_select(driver, config_dict):
row_index = 0 row_index = 0
for row in area_list: for row in area_list:
row_index += 1 row_index += 1
row_is_enabled=True
try:
# skip to check enable, due to modal dialog popup.
'''
if not row.is_enabled():
row_is_enabled=False
'''
row_text = "" row_text = ""
row_html = "" row_html = ""
# check buy button. try:
if row_is_enabled:
# .text is failed. @_@!
#row_text = row.text #row_text = row.text
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc:
if show_debug_message:
print(exc)
# error, exit loop
break
if len(row_text) > 0: if len(row_text) > 0:
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 = ""
row_is_enabled=False
if len(row_text) > 0: if len(row_text) > 0:
row_is_enabled=True
if row_is_enabled:
row_is_enabled=False row_is_enabled=False
for text_item in find_ticket_text_list: for text_item in find_ticket_text_list:
if text_item in row_text: if text_item in row_text:
@ -10743,11 +10746,6 @@ def ticketplus_date_auto_select(driver, config_dict):
print("match sold out text: %s, skip this row." % (sold_out_item)) print("match sold out text: %s, skip this row." % (sold_out_item))
break break
except Exception as exc:
if show_debug_message:
print(exc)
pass
if row_is_enabled: if row_is_enabled:
formated_area_list.append(row) formated_area_list.append(row)
@ -10917,9 +10915,6 @@ def ticketplus_order_expansion_auto_select(driver, config_dict, area_keyword_ite
soldout_count = 0 soldout_count = 0
for row in area_list: for row in area_list:
row_index += 1 row_index += 1
row_is_enabled=True
if row_is_enabled:
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -10927,7 +10922,10 @@ def ticketplus_order_expansion_auto_select(driver, config_dict, area_keyword_ite
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
pass if show_debug_message:
print(exc)
# error, exit loop
break
# for style_2 # for style_2
if len(row_text) > 0: if len(row_text) > 0:
@ -10960,10 +10958,7 @@ def ticketplus_order_expansion_auto_select(driver, config_dict, area_keyword_ite
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 row_text == "": if len(row_text) > 0:
row_is_enabled=False
if row_is_enabled:
formated_area_list.append(row) formated_area_list.append(row)
if soldout_count > 0: if soldout_count > 0:
@ -10995,8 +10990,6 @@ def ticketplus_order_expansion_auto_select(driver, config_dict, area_keyword_ite
row_index = 0 row_index = 0
for row in formated_area_list: for row in formated_area_list:
row_index += 1 row_index += 1
row_is_enabled=True
if row_is_enabled:
row_text = "" row_text = ""
row_html = "" row_html = ""
try: try:
@ -11004,6 +10997,9 @@ def ticketplus_order_expansion_auto_select(driver, config_dict, area_keyword_ite
row_html = row.get_attribute('innerHTML') row_html = row.get_attribute('innerHTML')
row_text = remove_html_tags(row_html) row_text = remove_html_tags(row_html)
except Exception as exc: except Exception as exc:
if show_debug_message:
print(exc)
# error, exit loop
break break
if len(row_text) > 0: if len(row_text) > 0:
@ -11893,7 +11889,10 @@ def main(args):
last_url = url last_url = url
if is_maxbot_paused: if is_maxbot_paused:
time.sleep(0.2) if 'kktix.c' in url:
kktix_dict = kktix_paused_main(driver, url, config_dict, kktix_dict)
time.sleep(0.1)
continue continue
tixcraft_family = False tixcraft_family = False