Update nodriver_tixcraft.py
parent
cb1d1d2a84
commit
8072620ede
|
@ -1,6 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#encoding=utf-8
|
#encoding=utf-8
|
||||||
#執行方式:python chrome_tixcraft.py 或 python3 chrome_tixcraft.py
|
|
||||||
import argparse
|
import argparse
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
|
@ -33,7 +32,7 @@ except Exception as exc:
|
||||||
print(exc)
|
print(exc)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2024.04.09)"
|
CONST_APP_VERSION = "MaxBot (2024.04.10)"
|
||||||
|
|
||||||
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
|
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
|
@ -214,7 +213,8 @@ async def nodriver_check_checkbox(tab, select_query, value='true'):
|
||||||
try:
|
try:
|
||||||
element = await tab.query_selector(select_query)
|
element = await tab.query_selector(select_query)
|
||||||
if element:
|
if element:
|
||||||
await element.apply('function (element) { element.checked='+ value +'; } ')
|
#await element.apply('function (element) { element.checked='+ value +'; } ')
|
||||||
|
await element.click()
|
||||||
is_checkbox_checked = True
|
is_checkbox_checked = True
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
#print("check checkbox fail for selector:", select_query)
|
#print("check checkbox fail for selector:", select_query)
|
||||||
|
@ -651,6 +651,9 @@ async def nodriver_kktix_reg_captcha(tab, config_dict, fail_list, registrationsN
|
||||||
inferred_answer_string = answer_item
|
inferred_answer_string = answer_item
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if len(answer_list) > 0:
|
||||||
|
answer_list = list(dict.fromkeys(answer_list))
|
||||||
|
|
||||||
if show_debug_message:
|
if show_debug_message:
|
||||||
print("inferred_answer_string:", inferred_answer_string)
|
print("inferred_answer_string:", inferred_answer_string)
|
||||||
print("question_text:", question_text)
|
print("question_text:", question_text)
|
||||||
|
@ -658,18 +661,28 @@ async def nodriver_kktix_reg_captcha(tab, config_dict, fail_list, registrationsN
|
||||||
print("fail_list:", fail_list)
|
print("fail_list:", fail_list)
|
||||||
|
|
||||||
# PS: auto-focus() when empty inferred_answer_string with empty inputed text value.
|
# PS: auto-focus() when empty inferred_answer_string with empty inputed text value.
|
||||||
input_text_css = 'div.custom-captcha-inner > div > div > input'
|
if len(inferred_answer_string) > 0:
|
||||||
next_step_button_css = ''
|
input_text_css = 'div.custom-captcha-inner > div > div > input'
|
||||||
submit_by_enter = False
|
next_step_button_css = ''
|
||||||
check_input_interval = 0.2
|
submit_by_enter = False
|
||||||
#is_answer_sent, fail_list = fill_common_verify_form(tab, config_dict, inferred_answer_string, fail_list, input_text_css, next_step_button_css, submit_by_enter, check_input_interval)
|
check_input_interval = 0.2
|
||||||
if len(answer_list) > 0:
|
#is_answer_sent, fail_list = fill_common_verify_form(tab, config_dict, inferred_answer_string, fail_list, input_text_css, next_step_button_css, submit_by_enter, check_input_interval)
|
||||||
input_text = await tab.query_selector(input_text_css)
|
if len(answer_list) > 0:
|
||||||
if not input_text is None:
|
input_text = await tab.query_selector(input_text_css)
|
||||||
await input_text.send_keys(answer_list[0])
|
if not input_text is None:
|
||||||
|
|
||||||
|
await input_text.click()
|
||||||
|
await input_text.apply('function (element) {element.value = ""; } ')
|
||||||
|
await input_text.send_keys(inferred_answer_string)
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
# due multi next buttons(pick seats/best seats)
|
||||||
|
print("click")
|
||||||
|
await nodriver_kktix_press_next_button(tab)
|
||||||
|
time.sleep(0.75)
|
||||||
|
|
||||||
|
fail_list.append(inferred_answer_string)
|
||||||
|
|
||||||
# due multi next buttons(pick seats/best seats)
|
|
||||||
await nodriver_kktix_press_next_button(tab)
|
|
||||||
|
|
||||||
return fail_list, is_question_popup
|
return fail_list, is_question_popup
|
||||||
|
|
||||||
|
@ -769,7 +782,7 @@ async def nodriver_kktix_reg_new_main(tab, config_dict, fail_list, played_sound_
|
||||||
play_sound_while_ordering(config_dict)
|
play_sound_while_ordering(config_dict)
|
||||||
played_sound_ticket = True
|
played_sound_ticket = True
|
||||||
|
|
||||||
is_finish_checkbox_click = await nodriver_check_checkbox(tab, 'input[type="checkbox"]')
|
is_finish_checkbox_click = await nodriver_check_checkbox(tab, 'input[type="checkbox"]:not(:checked)')
|
||||||
|
|
||||||
# whole event question.
|
# whole event question.
|
||||||
fail_list, is_question_popup = await nodriver_kktix_reg_captcha(tab, config_dict, fail_list, registrationsNewApp_div)
|
fail_list, is_question_popup = await nodriver_kktix_reg_captcha(tab, config_dict, fail_list, registrationsNewApp_div)
|
||||||
|
@ -1072,7 +1085,7 @@ async def nodriver_tixcraft_input_check_code(tab, config_dict, fail_list, questi
|
||||||
|
|
||||||
async def nodriver_tixcraft_ticket_main_agree(tab, config_dict):
|
async def nodriver_tixcraft_ticket_main_agree(tab, config_dict):
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
is_finish_checkbox_click = await nodriver_check_checkbox(tab, '#TicketForm_agree')
|
is_finish_checkbox_click = await nodriver_check_checkbox(tab, '#TicketForm_agree:not(:checked)')
|
||||||
if is_finish_checkbox_click:
|
if is_finish_checkbox_click:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -1450,7 +1463,7 @@ async def nodriver_ticketplus_main(tab, url, config_dict, ocr, Captcha_Browser):
|
||||||
|
|
||||||
async def nodriver_ibon_ticket_agree(tab):
|
async def nodriver_ibon_ticket_agree(tab):
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
is_finish_checkbox_click = await nodriver_check_checkbox(tab, '#agreen')
|
is_finish_checkbox_click = await nodriver_check_checkbox(tab, '#agreen:not(:checked)')
|
||||||
if is_finish_checkbox_click:
|
if is_finish_checkbox_click:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -1481,7 +1494,7 @@ async def nodriver_ibon_main(tab, url, config_dict, ocr, Captcha_Browser):
|
||||||
is_event_page = True
|
is_event_page = True
|
||||||
if is_event_page:
|
if is_event_page:
|
||||||
# ibon auto press signup
|
# ibon auto press signup
|
||||||
await nodriver_press_button('.btn.btn-signup')
|
await nodriver_press_button(tab, '.btn.btn-signup')
|
||||||
|
|
||||||
is_match_target_feature = False
|
is_match_target_feature = False
|
||||||
|
|
||||||
|
@ -1560,7 +1573,7 @@ async def nodriver_ibon_main(tab, url, config_dict, ocr, Captcha_Browser):
|
||||||
|
|
||||||
if 'PRODUCT_ID=' in url.upper():
|
if 'PRODUCT_ID=' in url.upper():
|
||||||
# step 1: select area.
|
# step 1: select area.
|
||||||
is_match_target_feature = True
|
is_price_assign_by_bot = False
|
||||||
# TODO:
|
# TODO:
|
||||||
#is_price_assign_by_bot = ibon_performance(driver, config_dict)
|
#is_price_assign_by_bot = ibon_performance(driver, config_dict)
|
||||||
|
|
||||||
|
@ -1578,8 +1591,7 @@ async def nodriver_ibon_main(tab, url, config_dict, ocr, Captcha_Browser):
|
||||||
if is_do_ibon_performance_with_ticket_number:
|
if is_do_ibon_performance_with_ticket_number:
|
||||||
if config_dict["advanced"]["disable_adjacent_seat"]:
|
if config_dict["advanced"]["disable_adjacent_seat"]:
|
||||||
# TODO:
|
# TODO:
|
||||||
#is_finish_checkbox_click = ibon_allow_not_adjacent_seat(driver, config_dict)
|
is_finish_checkbox_click = await nodriver_check_checkbox(tab, '.asp-checkbox > input[type="checkbox"]:not(:checked)')
|
||||||
pass
|
|
||||||
|
|
||||||
# captcha
|
# captcha
|
||||||
is_captcha_sent = False
|
is_captcha_sent = False
|
||||||
|
|
Loading…
Reference in New Issue