2024-03-27, fixbugs for ibon, support ibonqware signin with nodriver mode.

master
Your Name 2024-04-08 11:30:35 +08:00
parent 017a88334d
commit 06fb4e25ce
13 changed files with 386 additions and 144 deletions

View File

@ -44,7 +44,7 @@ except Exception as exc:
print(exc) print(exc)
pass pass
CONST_APP_VERSION = "MaxBot (2024.03.26)" CONST_APP_VERSION = "MaxBot (2024.03.27)"
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"
@ -859,7 +859,7 @@ def force_press_button_iframe(driver, f, select_by, select_query, force_submit=T
except Exception as exc: except Exception as exc:
pass pass
is_clicked = force_press_button(driver, select_by, select_query, force_submit) is_clicked = press_button(driver, select_by, select_query, force_submit)
if f: if f:
# switch back to main content, otherwise we will get StaleElementReferenceException # switch back to main content, otherwise we will get StaleElementReferenceException
@ -902,7 +902,7 @@ selectSoldoutItems.forEach((eachItem) =>
#print(exc) #print(exc)
pass pass
def force_press_button(driver, select_by, select_query, force_submit=True): def press_button(driver, select_by, select_query, force_submit=True):
ret = False ret = False
next_step_button = None next_step_button = None
try: try:
@ -1148,7 +1148,7 @@ def tixcraft_date_auto_select(driver, url, config_dict, domain_name):
if show_debug_message: if show_debug_message:
print("target_area got, start to press button.") print("target_area got, start to press button.")
is_date_clicked = force_press_button(target_area, By.CSS_SELECTOR,'button') is_date_clicked = press_button(target_area, By.CSS_SELECTOR,'button')
if not is_date_clicked: if not is_date_clicked:
if show_debug_message: if show_debug_message:
print("press button fail, try to click hyperlink.") print("press button fail, try to click hyperlink.")
@ -1172,7 +1172,7 @@ def tixcraft_date_auto_select(driver, url, config_dict, domain_name):
# for: ticketmaster.sg # for: ticketmaster.sg
is_date_clicked = force_press_button(target_area, By.CSS_SELECTOR,'a') is_date_clicked = press_button(target_area, By.CSS_SELECTOR,'a')
# [PS]: current reload condition only when # [PS]: current reload condition only when
if auto_reload_coming_soon_page_enable: if auto_reload_coming_soon_page_enable:
@ -1297,7 +1297,7 @@ def ticketmaster_date_auto_select(driver, url, config_dict, domain_name):
is_date_clicked = False is_date_clicked = False
if not target_area is None: if not target_area is None:
is_date_clicked = force_press_button(target_area, By.CSS_SELECTOR,'a') is_date_clicked = press_button(target_area, By.CSS_SELECTOR,'a')
if is_date_clicked: if is_date_clicked:
try: try:
window_handles_count = len(driver.window_handles) window_handles_count = len(driver.window_handles)
@ -1809,7 +1809,7 @@ def fill_common_verify_form(driver, config_dict, inferred_answer_string, fail_li
form_input_1.send_keys(Keys.ENTER) form_input_1.send_keys(Keys.ENTER)
is_button_clicked = True is_button_clicked = True
if len(next_step_button_css) > 0: if len(next_step_button_css) > 0:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, next_step_button_css) is_button_clicked = press_button(driver, By.CSS_SELECTOR, next_step_button_css)
except Exception as exc: except Exception as exc:
if show_debug_message: if show_debug_message:
print(exc) print(exc)
@ -1854,7 +1854,7 @@ def fill_common_verify_form(driver, config_dict, inferred_answer_string, fail_li
is_button_clicked = False is_button_clicked = False
form_input_2.send_keys(Keys.ENTER) form_input_2.send_keys(Keys.ENTER)
if len(next_step_button_css) > 0: if len(next_step_button_css) > 0:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, next_step_button_css) is_button_clicked = press_button(driver, By.CSS_SELECTOR, next_step_button_css)
if is_button_clicked: if is_button_clicked:
is_answer_sent = True is_answer_sent = True
@ -2142,10 +2142,12 @@ def tixcraft_auto_ocr(driver, ocr, away_from_keyboard_enable, previous_answer, C
return is_need_redo_ocr, previous_answer, is_form_sumbited return is_need_redo_ocr, previous_answer, is_form_sumbited
def tixcraft_ticket_main_agree(driver, config_dict): def tixcraft_ticket_main_agree(driver, config_dict):
is_finish_checkbox_click = False
for i in range(3): for i in range(3):
is_finish_checkbox_click = check_checkbox(driver, By.CSS_SELECTOR, '#TicketForm_agree') is_finish_checkbox_click = check_checkbox(driver, By.CSS_SELECTOR, '#TicketForm_agree')
if is_finish_checkbox_click: if is_finish_checkbox_click:
break break
return is_finish_checkbox_click
def get_tixcraft_ticket_select_by_keyword(driver, config_dict, area_keyword_item): def get_tixcraft_ticket_select_by_keyword(driver, config_dict, area_keyword_item):
show_debug_message = True # debug. show_debug_message = True # debug.
@ -2401,7 +2403,7 @@ def kktix_confirm_order_button(driver):
# : 2: /events/xxx/registrations/new # : 2: /events/xxx/registrations/new
# : This is ONLY for case-1, because case-2 lenght >5 # : This is ONLY for case-1, because case-2 lenght >5
def kktix_events_press_next_button(driver): def kktix_events_press_next_button(driver):
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'.tickets > a.btn-point') is_button_clicked = press_button(driver, By.CSS_SELECTOR,'.tickets > a.btn-point')
return is_button_clicked return is_button_clicked
# : This is for case-2 next button. # : This is for case-2 next button.
@ -4703,7 +4705,7 @@ def cityline_purchase_button_press(driver, config_dict):
is_button_clicked = False is_button_clicked = False
if is_date_assign_by_bot: if is_date_assign_by_bot:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, 'button.purchase-btn') is_button_clicked = press_button(driver, By.CSS_SELECTOR, 'button.purchase-btn')
return is_button_clicked return is_button_clicked
@ -5207,7 +5209,7 @@ def ibon_performance(driver, config_dict):
return is_price_assign_by_bot return is_price_assign_by_bot
def ibon_purchase_button_press(driver): def ibon_purchase_button_press(driver):
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, '#ticket-wrap > a.btn') is_button_clicked = press_button(driver, By.CSS_SELECTOR, '#ticket-wrap > a.btn')
return is_button_clicked return is_button_clicked
def assign_text(driver, by, query, val, overwrite = False, submit=False, overwrite_when = ""): def assign_text(driver, by, query, val, overwrite = False, submit=False, overwrite_when = ""):
@ -5355,7 +5357,7 @@ def cityline_login(driver, account, password):
# press "click here" use password to login. # press "click here" use password to login.
if is_email_sent: if is_email_sent:
is_click_here_pressed = force_press_button(driver, By.CSS_SELECTOR,'.otp-box > ul > li:nth-child(3) > a') is_click_here_pressed = press_button(driver, By.CSS_SELECTOR,'.otp-box > ul > li:nth-child(3) > a')
is_password_sent = False is_password_sent = False
if is_email_sent: if is_email_sent:
@ -5482,7 +5484,7 @@ def kham_login(driver, account, password):
pass pass
if is_password_sent: if is_password_sent:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'div.memberContent > p > a > button.red') is_button_clicked = press_button(driver, By.CSS_SELECTOR,'div.memberContent > p > a > button.red')
ret = is_password_sent ret = is_password_sent
@ -5543,7 +5545,7 @@ def ticket_login(driver, account, password):
pass pass
if is_password_sent: if is_password_sent:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'input[value="登入"]') is_button_clicked = press_button(driver, By.CSS_SELECTOR,'input[value="登入"]')
ret = is_password_sent ret = is_password_sent
@ -5899,7 +5901,7 @@ def ticketmaster_assign_ticket_number(driver, config_dict):
# must wait ticket number assign to focus captcha. # must wait ticket number assign to focus captcha.
if is_ticket_number_assigned: if is_ticket_number_assigned:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'#autoMode') is_button_clicked = press_button(driver, By.CSS_SELECTOR,'#autoMode')
def ticketmaster_captcha(driver, config_dict, ocr, Captcha_Browser, domain_name): def ticketmaster_captcha(driver, config_dict, ocr, Captcha_Browser, domain_name):
show_debug_message = True # debug. show_debug_message = True # debug.
@ -6432,7 +6434,7 @@ def urbtix_auto_survey(driver, config_dict):
if question_direction in ['left','right']: if question_direction in ['left','right']:
for answer_item in util.synonym_dict(question_answer_char): for answer_item in util.synonym_dict(question_answer_char):
if answer_item in option_content_div_text: if answer_item in option_content_div_text:
is_radio_clicked = force_press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') is_radio_clicked = press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper')
if is_radio_clicked: if is_radio_clicked:
if show_debug_message: if show_debug_message:
print("fill answer:", answer_item) print("fill answer:", answer_item)
@ -6442,7 +6444,7 @@ def urbtix_auto_survey(driver, config_dict):
if question_direction == "count": if question_direction == "count":
for answer_item in util.synonym_dict(question_answer_char): for answer_item in util.synonym_dict(question_answer_char):
if answer_item in option_content_div_text: if answer_item in option_content_div_text:
is_radio_clicked = force_press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') is_radio_clicked = press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper')
if is_radio_clicked: if is_radio_clicked:
if show_debug_message: if show_debug_message:
print("fill answer:", answer_item) print("fill answer:", answer_item)
@ -6456,7 +6458,7 @@ def urbtix_auto_survey(driver, config_dict):
if 'LESS THEN ONE' in option_content_div_text.upper(): if 'LESS THEN ONE' in option_content_div_text.upper():
is_match_none = True is_match_none = True
if is_match_none: if is_match_none:
is_radio_clicked = force_press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') is_radio_clicked = press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper')
if is_radio_clicked: if is_radio_clicked:
if show_debug_message: if show_debug_message:
print("fill answer:", '沒有') print("fill answer:", '沒有')
@ -6479,7 +6481,7 @@ def urbtix_auto_survey(driver, config_dict):
if 'MORE THEN' in option_content_div_text.upper() and answer_item + '' in option_content_div_text: if 'MORE THEN' in option_content_div_text.upper() and answer_item + '' in option_content_div_text:
is_match_more_then = True is_match_more_then = True
if is_match_more_then: if is_match_more_then:
is_radio_clicked = force_press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') is_radio_clicked = press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper')
if is_radio_clicked: if is_radio_clicked:
if show_debug_message: if show_debug_message:
print("fill answer:", answer_item + '個或以上') print("fill answer:", answer_item + '個或以上')
@ -6520,7 +6522,7 @@ def urbtix_auto_survey(driver, config_dict):
if questions_remain_text == "0" or questions_remain_text == "": if questions_remain_text == "0" or questions_remain_text == "":
is_button_clicked = False is_button_clicked = False
#is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, 'div.button-wrapper > div.button-text-multi-lines > div') #is_button_clicked = press_button(driver, By.CSS_SELECTOR, 'div.button-wrapper > div.button-text-multi-lines > div')
# Message: Element <div class="text-tc"> is not clickable at point (351,566) because another element <div class="modal-wrapper landing-question"> obscures it # Message: Element <div class="text-tc"> is not clickable at point (351,566) because another element <div class="modal-wrapper landing-question"> obscures it
btn_submit = None btn_submit = None
@ -6660,7 +6662,7 @@ def cityline_shows_goto_cta(driver):
def cityline_cookie_accept(driver): def cityline_cookie_accept(driver):
is_btn_click = force_press_button(driver, By.CSS_SELECTOR,'.cookieWrapper_closeBtn') is_btn_click = press_button(driver, By.CSS_SELECTOR,'.cookieWrapper_closeBtn')
def cityline_auto_retry_access(driver, config_dict): def cityline_auto_retry_access(driver, config_dict):
btn_retry = None btn_retry = None
@ -6880,25 +6882,11 @@ def ibon_verification_question(driver, fail_list, config_dict):
def ibon_ticket_agree(driver): def ibon_ticket_agree(driver):
# check agree
form_checkbox = None
try:
form_checkbox = driver.find_element(By.CSS_SELECTOR, '#agreen')
except Exception as exc:
#print("find #agreen fail")
pass
is_finish_checkbox_click = False is_finish_checkbox_click = False
if not form_checkbox is None: for i in range(3):
try: is_finish_checkbox_click = check_checkbox(driver, By.CSS_SELECTOR, '#agreen')
if form_checkbox.is_enabled(): if is_finish_checkbox_click:
if not form_checkbox.is_selected(): break
form_checkbox.click()
is_finish_checkbox_click = True
except Exception as exc:
print("click #agreen fail, try plan_b click label.")
is_finish_checkbox_click = force_press_button(driver, By.CSS_SELECTOR,'label[for="agreen"]')
return is_finish_checkbox_click return is_finish_checkbox_click
def ibon_check_sold_out(driver): def ibon_check_sold_out(driver):
@ -6921,10 +6909,6 @@ def ibon_check_sold_out(driver):
return is_sold_out return is_sold_out
def ibon_auto_signup(driver):
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, '.btn.btn-signup')
return is_button_clicked
def ibon_keyin_captcha_code(driver, answer = "", auto_submit = False): def ibon_keyin_captcha_code(driver, answer = "", auto_submit = False):
is_verifyCode_editing = False is_verifyCode_editing = False
@ -7144,9 +7128,9 @@ def ibon_main(driver, url, config_dict, ibon_dict, ocr, Captcha_Browser):
is_event_page = False is_event_page = False
if len(url.split('/'))==5: if len(url.split('/'))==5:
is_event_page = True is_event_page = True
if is_event_page: if is_event_page:
ibon_auto_signup(driver) # ibon auto press signup
is_button_clicked = press_button(driver, By.CSS_SELECTOR, '.btn.btn-signup')
is_match_target_feature = False is_match_target_feature = False
@ -7263,7 +7247,7 @@ def ibon_main(driver, url, config_dict, ibon_dict, ocr, Captcha_Browser):
if is_sold_out: if is_sold_out:
print("is_sold_out, go back , and refresh.") print("is_sold_out, go back , and refresh.")
# plan-A # plan-A
#is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, 'a.btn.btn-primary') #is_button_clicked = press_button(driver, By.CSS_SELECTOR, 'a.btn.btn-primary')
# plan-B, easy and better than plan-A # plan-B, easy and better than plan-A
try: try:
driver.back() driver.back()
@ -7285,27 +7269,22 @@ def ibon_main(driver, url, config_dict, ibon_dict, ocr, Captcha_Browser):
is_event_page = False is_event_page = False
if is_event_page: if is_event_page:
is_finish_checkbox_click = False
if is_event_page: if is_event_page:
for i in range(3): is_match_target_feature = True
is_finish_checkbox_click = ibon_ticket_agree(driver) is_finish_checkbox_click = ibon_ticket_agree(driver)
if is_finish_checkbox_click: if is_finish_checkbox_click:
break is_name_based = False
try:
my_css_selector = "body"
html_body = driver.find_element(By.CSS_SELECTOR, my_css_selector)
if not html_body is None:
if '實名制' in html_body.text:
is_name_based = True
except Exception as exc:
pass
if is_finish_checkbox_click: if not is_name_based:
is_name_based = False is_button_clicked = press_button(driver, By.CSS_SELECTOR, 'a.btn.btn-pink.continue')
try:
my_css_selector = "body"
html_body = driver.find_element(By.CSS_SELECTOR, my_css_selector)
if not html_body is None:
if '實名制' in html_body.text:
is_name_based = True
is_match_target_feature = True
except Exception as exc:
pass
if not is_name_based:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, 'a.btn.btn-pink.continue')
return ibon_dict return ibon_dict
@ -7613,7 +7592,7 @@ def hkticketing_date_auto_select(driver, config_dict, fail_list):
el_btn = None el_btn = None
if is_auto_submit: if is_auto_submit:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, '#buyButton > input') is_button_clicked = press_button(driver, By.CSS_SELECTOR, '#buyButton > input')
if show_debug_message: if show_debug_message:
print("is_button_clicked:", is_button_clicked) print("is_button_clicked:", is_button_clicked)
@ -8309,15 +8288,15 @@ def softix_powerweb_main(driver, url, config_dict, hkticketing_dict):
def khan_go_buy_redirect(driver, domain_name): def khan_go_buy_redirect(driver, domain_name):
is_button_clicked = False is_button_clicked = False
if 'kham.com' in domain_name: if 'kham.com' in domain_name:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, 'p > a > button.red') is_button_clicked = press_button(driver, By.CSS_SELECTOR, 'p > a > button.red')
if 'ticket.com' in domain_name: if 'ticket.com' in domain_name:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, 'div.row > div > a.btn.btn-order.btn-block') is_button_clicked = press_button(driver, By.CSS_SELECTOR, 'div.row > div > a.btn.btn-order.btn-block')
if 'udnfunlife.com' in domain_name: if 'udnfunlife.com' in domain_name:
# udn 快速訂購 # udn 快速訂購
my_css_selector = 'button[name="fastBuy"]' my_css_selector = 'button[name="fastBuy"]'
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, my_css_selector) is_button_clicked = press_button(driver, By.CSS_SELECTOR, my_css_selector)
if not is_button_clicked: if not is_button_clicked:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, '#buttonBuy') is_button_clicked = press_button(driver, By.CSS_SELECTOR, '#buttonBuy')
return is_button_clicked return is_button_clicked
def hkam_date_auto_select(driver, domain_name, config_dict): def hkam_date_auto_select(driver, domain_name, config_dict):
@ -8512,7 +8491,7 @@ def kham_product(driver, domain_name, config_dict):
if not is_date_assign_by_bot: if not is_date_assign_by_bot:
# click not on sale now. # click not on sale now.
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button') is_button_clicked = press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button')
pass pass
return is_date_assign_by_bot return is_date_assign_by_bot
@ -9115,7 +9094,7 @@ def kham_check_captcha_text_error(driver, config_dict):
if el_message_text is None: if el_message_text is None:
el_message_text = "" el_message_text = ""
if "【驗證碼】輸入錯誤" in el_message_text: if "【驗證碼】輸入錯誤" in el_message_text:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button') is_button_clicked = press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button')
is_reset_password_text = True is_reset_password_text = True
kham_keyin_captcha_code(driver) kham_keyin_captcha_code(driver)
except Exception as exc: except Exception as exc:
@ -9161,7 +9140,7 @@ def kham_main(driver, url, config_dict, ocr, Captcha_Browser):
] ]
for each_url in home_url_list: for each_url in home_url_list:
if each_url == url.lower(): if each_url == url.lower():
#is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'.closeBTN') #is_button_clicked = press_button(driver, By.CSS_SELECTOR,'.closeBTN')
clean_tag_by_selector(driver, ".popoutBG") clean_tag_by_selector(driver, ".popoutBG")
if config_dict["ocr_captcha"]["enable"]: if config_dict["ocr_captcha"]["enable"]:
@ -9232,7 +9211,7 @@ def kham_main(driver, url, config_dict, ocr, Captcha_Browser):
# layout format #1 # layout format #1
is_ticket_number_assigned = assign_text(driver, By.CSS_SELECTOR, select_query, str(config_dict["ticket_number"]), overwrite_when="0") is_ticket_number_assigned = assign_text(driver, By.CSS_SELECTOR, select_query, str(config_dict["ticket_number"]), overwrite_when="0")
if is_ticket_number_assigned: if is_ticket_number_assigned:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'#buttonNext') is_button_clicked = press_button(driver, By.CSS_SELECTOR,'#buttonNext')
else: else:
# layout format #2 # layout format #2
date_auto_select_enable = config_dict["date_auto_select"]["enable"] date_auto_select_enable = config_dict["date_auto_select"]["enable"]
@ -9247,7 +9226,7 @@ def kham_main(driver, url, config_dict, ocr, Captcha_Browser):
is_ticket_number_sent = assign_text(driver, By.CSS_SELECTOR, 'input#QRY2', str(config_dict["ticket_number"]), overwrite_when="0") is_ticket_number_sent = assign_text(driver, By.CSS_SELECTOR, 'input#QRY2', str(config_dict["ticket_number"]), overwrite_when="0")
if is_ticket_number_sent: if is_ticket_number_sent:
is_fastbuy_pressed = force_press_button(driver, By.CSS_SELECTOR,'input#f_btn') is_fastbuy_pressed = press_button(driver, By.CSS_SELECTOR,'input#f_btn')
else: else:
# kham / ticket. # kham / ticket.
@ -9270,7 +9249,7 @@ def kham_main(driver, url, config_dict, ocr, Captcha_Browser):
is_captcha_sent = kham_captcha(driver, config_dict, ocr, Captcha_Browser, model_name) is_captcha_sent = kham_captcha(driver, config_dict, ocr, Captcha_Browser, model_name)
my_css_selector = 'div.ui-dialog-buttonset > button.ui-button' my_css_selector = 'div.ui-dialog-buttonset > button.ui-button'
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, my_css_selector) is_button_clicked = press_button(driver, By.CSS_SELECTOR, my_css_selector)
if config_dict["area_auto_select"]["enable"]: if config_dict["area_auto_select"]["enable"]:
if "ticket.com.tw" in url: if "ticket.com.tw" in url:
is_switch_to_auto_seat = ticket_switch_to_auto_seat(driver) is_switch_to_auto_seat = ticket_switch_to_auto_seat(driver)
@ -9342,7 +9321,7 @@ def kham_main(driver, url, config_dict, ocr, Captcha_Browser):
else: else:
is_finish_checkbox_click = kham_allow_not_adjacent_seat(driver, config_dict) is_finish_checkbox_click = kham_allow_not_adjacent_seat(driver, config_dict)
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button') is_button_clicked = press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button')
if config_dict["ocr_captcha"]["enable"]: if config_dict["ocr_captcha"]["enable"]:
if not is_captcha_sent: if not is_captcha_sent:
is_captcha_sent = kham_captcha(driver, config_dict, ocr, Captcha_Browser, model_name) is_captcha_sent = kham_captcha(driver, config_dict, ocr, Captcha_Browser, model_name)
@ -9370,7 +9349,7 @@ def kham_main(driver, url, config_dict, ocr, Captcha_Browser):
pass pass
if '/utk13/utk1306_.aspx' in url.lower(): if '/utk13/utk1306_.aspx' in url.lower():
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button') is_button_clicked = press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button')
if config_dict["ocr_captcha"]["enable"]: if config_dict["ocr_captcha"]["enable"]:
model_name = url.split('/')[5] model_name = url.split('/')[5]
if len(model_name) > 7: if len(model_name) > 7:
@ -10276,7 +10255,7 @@ svgToPng(svg, (imgData) => {
previous_answer = ocr_answer previous_answer = ocr_answer
print("refresh captcha...") print("refresh captcha...")
my_css_selector = "div.recaptcha-area > div > div > span > i" my_css_selector = "div.recaptcha-area > div > div > span > i"
is_refresh_button_pressed = force_press_button(driver, By.CSS_SELECTOR, my_css_selector) is_refresh_button_pressed = press_button(driver, By.CSS_SELECTOR, my_css_selector)
# must have time to load captcha image. # must have time to load captcha image.
time.sleep(0.4) time.sleep(0.4)
else: else:
@ -10308,7 +10287,7 @@ def ticketplus_check_and_renew_captcha(driver):
is_messages_popup = True is_messages_popup = True
print("error message popup, refresh captcha images.") print("error message popup, refresh captcha images.")
my_css_selector = "div.recaptcha-area > div > div > span > i" my_css_selector = "div.recaptcha-area > div > div > span > i"
is_refresh_button_pressed = force_press_button(driver, By.CSS_SELECTOR, my_css_selector) is_refresh_button_pressed = press_button(driver, By.CSS_SELECTOR, my_css_selector)
# must have time to load captcha image. # must have time to load captcha image.
time.sleep(0.4) time.sleep(0.4)
except Exception as exc: except Exception as exc:
@ -10414,11 +10393,11 @@ def ticketplus_keyin_captcha_code(driver, answer = "", auto_submit = False):
# for style_2 # for style_2
my_css_selector = "div.order-footer > div.container > div.row > div > button.nextBtn" my_css_selector = "div.order-footer > div.container > div.row > div > button.nextBtn"
is_form_sumbited = force_press_button(driver, By.CSS_SELECTOR, my_css_selector) is_form_sumbited = press_button(driver, By.CSS_SELECTOR, my_css_selector)
if not is_form_sumbited: if not is_form_sumbited:
# for style_1 # for style_1
my_css_selector = "div.order-footer > div.container > div.row > div > div.row > div > button.nextBtn" my_css_selector = "div.order-footer > div.container > div.row > div > div.row > div > button.nextBtn"
is_form_sumbited = force_press_button(driver, By.CSS_SELECTOR, my_css_selector) is_form_sumbited = press_button(driver, By.CSS_SELECTOR, my_css_selector)
if is_form_sumbited: if is_form_sumbited:
# must delay 0.5 second wait ajax return. # must delay 0.5 second wait ajax return.
@ -10607,17 +10586,17 @@ def ticketplus_account_sign_in(driver, config_dict):
# 未結帳訂單 (order) # 未結帳訂單 (order)
def ticketplus_accept_realname_card(driver): def ticketplus_accept_realname_card(driver):
select_query = 'div.v-dialog__content > div > div > div > div.row > div > button.primary' select_query = 'div.v-dialog__content > div > div > div > div.row > div > button.primary'
return force_press_button(driver, By.CSS_SELECTOR, select_query) return press_button(driver, By.CSS_SELECTOR, select_query)
# 好玩其他活動 # 好玩其他活動
def ticketplus_accept_other_activity(driver): def ticketplus_accept_other_activity(driver):
select_query = 'div[role="dialog"] > div.v-dialog > button.primary-1 > span > i.v-icon' select_query = 'div[role="dialog"] > div.v-dialog > button.primary-1 > span > i.v-icon'
return force_press_button(driver, By.CSS_SELECTOR, select_query) return press_button(driver, By.CSS_SELECTOR, select_query)
# 購票失敗 您選擇的票種已售完或本活動有限制購票總張數,請詳閱 注意事項 # 購票失敗 您選擇的票種已售完或本活動有限制購票總張數,請詳閱 注意事項
def ticketplus_accept_order_fail(driver): def ticketplus_accept_order_fail(driver):
select_query = 'div[role="dialog"] > div.v-dialog > div.v-card > div > div.row > div.col > button.v-btn' select_query = 'div[role="dialog"] > div.v-dialog > div.v-card > div > div.row > div.col > button.v-btn'
return force_press_button(driver, By.CSS_SELECTOR, select_query) return press_button(driver, By.CSS_SELECTOR, select_query)
def ticketplus_ticket_agree(driver, config_dict): def ticketplus_ticket_agree(driver, config_dict):
show_debug_message = True # debug. show_debug_message = True # debug.
@ -10727,6 +10706,15 @@ def ticketplus_main(driver, url, config_dict, ocr, Captcha_Browser, ticketplus_d
return ticketplus_dict return ticketplus_dict
def facebook_main(driver, config_dict):
facebook_account = config_dict["advanced"]["facebook_account"].strip()
facebook_password = config_dict["advanced"]["facebook_password_plaintext"].strip()
if facebook_password == "":
facebook_password = util.decryptMe(config_dict["advanced"]["facebook_password"])
if len(facebook_account) > 4:
facebook_login(driver, facebook_account, facebook_password)
time.sleep(2)
def get_current_url(driver): def get_current_url(driver):
DISCONNECTED_MSG = ': target window already closed' DISCONNECTED_MSG = ': target window already closed'
@ -10875,6 +10863,8 @@ def main(args):
tixcraft_dict["elapsed_time"]=None tixcraft_dict["elapsed_time"]=None
tixcraft_dict["is_popup_checkout"] = False tixcraft_dict["is_popup_checkout"] = False
tixcraft_dict["area_retry_count"]=0 tixcraft_dict["area_retry_count"]=0
tixcraft_dict["played_sound_ticket"] = False
tixcraft_dict["played_sound_order"] = False
# for kktix # for kktix
kktix_dict = {} kktix_dict = {}
@ -11023,16 +11013,10 @@ def main(args):
if softix_family: if softix_family:
hkticketing_dict = softix_powerweb_main(driver, url, config_dict, hkticketing_dict) hkticketing_dict = softix_powerweb_main(driver, url, config_dict, hkticketing_dict)
# for facebook # for facebook signin
facebook_login_url = 'https://www.facebook.com/login.php?' facebook_login_url = 'https://www.facebook.com/login.php?'
if url[:len(facebook_login_url)]==facebook_login_url: if url[:len(facebook_login_url)]==facebook_login_url:
facebook_account = config_dict["advanced"]["facebook_account"].strip() facebook_main(driver, config_dict)
facebook_password = config_dict["advanced"]["facebook_password_plaintext"].strip()
if facebook_password == "":
facebook_password = util.decryptMe(config_dict["advanced"]["facebook_password"])
if len(facebook_account) > 4:
facebook_login(driver, facebook_account, facebook_password)
time.sleep(2)
def cli(): def cli():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(

View File

@ -24,7 +24,7 @@ import webbrowser
import util import util
CONST_APP_VERSION = "MaxBot (2024.03.26)" CONST_APP_VERSION = "MaxBot (2024.03.27)"
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json" CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -29,7 +29,7 @@ from datetime import datetime
import util import util
CONST_APP_VERSION = "MaxBot (2024.03.26)" CONST_APP_VERSION = "MaxBot (2024.03.27)"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json" CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json"

View File

@ -32,7 +32,7 @@ except Exception as exc:
print(exc) print(exc)
pass pass
CONST_APP_VERSION = "MaxBot (2024.03.26)" CONST_APP_VERSION = "MaxBot (2024.03.27)"
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"
@ -191,6 +191,34 @@ def play_sound_while_ordering(config_dict):
captcha_sound_filename = os.path.join(app_root, config_dict["advanced"]["play_sound"]["filename"].strip()) captcha_sound_filename = os.path.join(app_root, config_dict["advanced"]["play_sound"]["filename"].strip())
util.play_mp3_async(captcha_sound_filename) util.play_mp3_async(captcha_sound_filename)
async def nodriver_press_button(tab, select_query):
if tab:
try:
element = await tab.query_selector(select_query)
if element:
await element.click()
else:
#print("element not found:", select_query)
pass
except Exception as e:
#print("click fail for selector:", select_query)
print(e)
pass
async def nodriver_check_checkbox(tab, select_query, value='true'):
is_checkbox_checked = False
if tab:
try:
element = await tab.query_selector(select_query)
if element:
await element.apply('function (element) { element.checked='+ value +'; } ')
is_checkbox_checked = True
except Exception as exc:
#print("check checkbox fail for selector:", select_query)
print(exc)
pass
return is_checkbox_checked
async def nodriver_facebook_login(tab, facebook_account, facebook_password): async def nodriver_facebook_login(tab, facebook_account, facebook_password):
if tab: if tab:
try: try:
@ -295,20 +323,30 @@ async def nodriver_goto_homepage(driver, config_dict):
tixcraft_sid = config_dict["advanced"]["tixcraft_sid"] tixcraft_sid = config_dict["advanced"]["tixcraft_sid"]
if len(tixcraft_sid) > 1: if len(tixcraft_sid) > 1:
cookies = await driver.cookies.get_all() cookies = await driver.cookies.get_all()
is_cookie_exist = False
for cookie in cookies: for cookie in cookies:
if cookie.name=='SID': if cookie.name=='SID':
cookie.value=tixcraft_sid cookie.value=tixcraft_sid
is_cookie_exist = True
break break
if not is_cookie_exist:
new_cookie = cdp.network.CookieParam("SID",tixcraft_sid, domain="tixcraft.com", path="/", http_only=True, secure=True)
cookies.append(new_cookie)
await driver.cookies.set_all(cookies) await driver.cookies.set_all(cookies)
if 'ibon.com' in homepage: if 'ibon.com' in homepage:
ibonqware = config_dict["advanced"]["ibonqware"] ibonqware = config_dict["advanced"]["ibonqware"]
if len(ibonqware) > 1: if len(ibonqware) > 1:
cookies = await driver.cookies.get_all() cookies = await driver.cookies.get_all()
is_cookie_exist = False
for cookie in cookies: for cookie in cookies:
if cookie.name=='ibonqware': if cookie.name=='ibonqware':
cookie.value=ibonqware cookie.value=ibonqware
is_cookie_exist = True
break break
if not is_cookie_exist:
new_cookie = cdp.network.CookieParam("ibonqware",ibonqware, domain=".ibon.com.tw", path="/", http_only=True, secure=True)
cookies.append(new_cookie)
await driver.cookies.set_all(cookies) await driver.cookies.set_all(cookies)
return tab return tab
@ -776,12 +814,13 @@ async def nodriver_kktix_main(tab, url, config_dict, kktix_dict):
try: try:
html_body = await tab.get_content() html_body = await tab.get_content()
#print("html_body:",len(html_body)) #print("html_body:",len(html_body))
if len(html_body) > 10240: if html_body:
if "registrationsNewApp" in html_body: if len(html_body) > 10240:
if not "{{'new.i_read_and_agree_to'" in html_body: if "registrationsNewApp" in html_body:
is_dom_ready = True if not "{{'new.i_read_and_agree_to'" in html_body:
is_dom_ready = True
except Exception as exc: except Exception as exc:
print(exc) #print(exc)
pass pass
if not is_dom_ready: if not is_dom_ready:
@ -977,6 +1016,26 @@ async def nodriver_tixcraft_input_check_code(tab, config_dict, fail_list, questi
return fail_list return fail_list
async def nodriver_tixcraft_ticket_main_agree(tab, config_dict):
for i in range(3):
is_finish_checkbox_click = await nodriver_check_checkbox(tab, '#TicketForm_agree')
if is_finish_checkbox_click:
break
async def nodriver_tixcraft_ticket_main(tab, config_dict, ocr, Captcha_Browser, domain_name):
is_agree_at_webdriver = False
if not config_dict["browser"] in CONST_CHROME_FAMILY:
is_agree_at_webdriver = True
else:
if not config_dict["advanced"]["chrome_extension"]:
is_agree_at_webdriver = True
#print("is_agree_at_webdriver:", is_agree_at_webdriver)
if is_agree_at_webdriver:
# use extension instead of selenium.
# checkbox javascrit code at chrome extension.
await nodriver_tixcraft_ticket_main_agree(tab, config_dict)
async def nodriver_tixcraft_main(tab, url, config_dict, tixcraft_dict, ocr, Captcha_Browser): async def nodriver_tixcraft_main(tab, url, config_dict, tixcraft_dict, ocr, Captcha_Browser):
await nodriver_tixcraft_home_close_window(tab) await nodriver_tixcraft_home_close_window(tab)
@ -1054,8 +1113,7 @@ async def nodriver_tixcraft_main(tab, url, config_dict, tixcraft_dict, ocr, Capt
# main app, to select ticket number. # main app, to select ticket number.
if '/ticket/ticket/' in url: if '/ticket/ticket/' in url:
domain_name = url.split('/')[2] domain_name = url.split('/')[2]
# TODO: await nodriver_tixcraft_ticket_main(tab, config_dict, ocr, Captcha_Browser, domain_name)
#tixcraft_ticket_main(driver, config_dict, ocr, Captcha_Browser, domain_name)
tixcraft_dict["done_time"] = time.time() tixcraft_dict["done_time"] = time.time()
if config_dict["advanced"]["play_sound"]["ticket"]: if config_dict["advanced"]["play_sound"]["ticket"]:
@ -1319,6 +1377,220 @@ async def nodriver_ticketplus_main(tab, url, config_dict, ocr, Captcha_Browser,
return ticketplus_dict return ticketplus_dict
async def nodriver_ibon_ticket_agree(tab):
for i in range(3):
is_finish_checkbox_click = await nodriver_check_checkbox(tab, '#agreen')
if is_finish_checkbox_click:
break
async def nodriver_ibon_main(tab, url, config_dict, ibon_dict, ocr, Captcha_Browser):
home_url_list = ['https://ticket.ibon.com.tw/'
,'https://ticket.ibon.com.tw/index/entertainment'
]
for each_url in home_url_list:
if each_url == url.lower():
if config_dict["ocr_captcha"]["enable"]:
# TODO:
#set_non_browser_cookies(driver, url, Captcha_Browser)
pass
break
# https://tour.ibon.com.tw/event/e23010000300mxu
if 'tour' in url.lower() and '/event/' in url.lower():
is_event_page = False
if len(url.split('/'))==5:
is_event_page = True
if is_event_page:
# ibon auto press signup
await nodriver_press_button('.btn.btn-signup')
is_match_target_feature = False
#PS: ibon some utk is upper case, some is lower.
if not is_match_target_feature:
#https://ticket.ibon.com.tw/ActivityInfo/Details/0000?pattern=entertainment
if '/activityinfo/details/' in url.lower():
is_event_page = False
if len(url.split('/'))==6:
is_event_page = True
if is_event_page:
if config_dict["date_auto_select"]["enable"]:
is_match_target_feature = True
# TODO:
#is_date_assign_by_bot = ibon_date_auto_select(driver, config_dict)
pass
if 'ibon.com.tw/error.html?' in url.lower():
try:
tab.back()
except Exception as exc:
pass
is_enter_verify_mode = False
if not is_match_target_feature:
# validation question url:
# https://orders.ibon.com.tw/application/UTK02/UTK0201_0.aspx?rn=1180872370&PERFORMANCE_ID=B04M7XZT&PRODUCT_ID=B04KS88E&SHOW_PLACE_MAP=True
is_event_page = False
if '/UTK02/UTK0201_0.' in url.upper():
if '.aspx?' in url.lower():
if 'rn=' in url.lower():
if 'PERFORMANCE_ID=' in url.upper():
if "PRODUCT_ID=" in url.upper():
is_event_page = True
if is_event_page:
is_enter_verify_mode = True
# TODO:
#ibon_dict["fail_list"] = ibon_verification_question(driver, ibon_dict["fail_list"], config_dict)
pass
is_match_target_feature = True
if not is_enter_verify_mode:
ibon_dict["fail_list"] = []
if not is_match_target_feature:
# https://orders.ibon.com.tw/application/UTK02/UTK0201_000.aspx?PERFORMANCE_ID=0000
# https://orders.ibon.com.tw/application/UTK02/UTK0201_000.aspx?rn=1111&PERFORMANCE_ID=2222&PRODUCT_ID=BBBB
# https://orders.ibon.com.tw/application/UTK02/UTK0201_001.aspx?PERFORMANCE_ID=2222&GROUP_ID=4&PERFORMANCE_PRICE_AREA_ID=3333
is_event_page = False
if '/UTK02/UTK0201_' in url.upper():
if '.aspx?' in url.lower():
if 'PERFORMANCE_ID=' in url.upper():
if len(url.split('/'))==6:
is_event_page = True
if '/UTK02/UTK0202_' in url.upper():
if '.aspx?' in url.lower():
if 'PERFORMANCE_ID=' in url.upper():
if len(url.split('/'))==6:
is_event_page = True
if is_event_page:
if config_dict["area_auto_select"]["enable"]:
select_query = "tr.disbled"
# TODO:
#clean_tag_by_selector(driver,select_query)
select_query = "tr.sold-out"
# TODO:
#clean_tag_by_selector(driver,select_query)
is_do_ibon_performance_with_ticket_number = False
if 'PRODUCT_ID=' in url.upper():
# step 1: select area.
is_match_target_feature = True
# TODO:
#is_price_assign_by_bot = ibon_performance(driver, config_dict)
#print("is_price_assign_by_bot:", is_price_assign_by_bot)
if not is_price_assign_by_bot:
# this case show captcha and ticket-number in this page.
# TODO:
#if ibon_ticket_number_appear(driver, config_dict):
# is_do_ibon_performance_with_ticket_number = True
pass
if 'PERFORMANCE_PRICE_AREA_ID=' in url.upper():
is_do_ibon_performance_with_ticket_number = True
if is_do_ibon_performance_with_ticket_number:
if config_dict["advanced"]["disable_adjacent_seat"]:
# TODO:
#is_finish_checkbox_click = ibon_allow_not_adjacent_seat(driver, config_dict)
pass
# captcha
is_captcha_sent = False
if config_dict["ocr_captcha"]["enable"]:
domain_name = url.split('/')[2]
model_name = url.split('/')[5]
if len(model_name) > 7:
model_name=model_name[:7]
captcha_url = '/pic.aspx?TYPE=%s' % (model_name)
#PS: need set cookies once, if user change domain.
if not Captcha_Browser is None:
Captcha_Browser.Set_Domain(domain_name, captcha_url=captcha_url)
# TODO:
#is_captcha_sent = ibon_captcha(driver, config_dict, ocr, Captcha_Browser, model_name)
pass
# assign ticket number.
is_match_target_feature = True
is_ticket_number_assigned = False
# TODO:
#is_ticket_number_assigned = ibon_ticket_number_auto_select(driver, config_dict)
#print("is_ticket_number_assigned:", is_ticket_number_assigned)
if is_ticket_number_assigned:
if is_captcha_sent:
# TODO:
#click_ret = ibon_purchase_button_press(driver)
pass
# only this case: "ticket number CHANGED by bot" and "cpatcha sent" to play sound!
if click_ret:
play_sound_while_ordering(config_dict)
else:
is_sold_out = False
# TODO:
#is_sold_out = ibon_check_sold_out(driver)
if is_sold_out:
print("is_sold_out, go back , and refresh.")
# plan-A
#is_button_clicked = press_button(tab, By.CSS_SELECTOR, 'a.btn.btn-primary')
# plan-B, easy and better than plan-A
try:
tab.back()
tab.reload()
except Exception as exc:
pass
if not is_match_target_feature:
#https://orders.ibon.com.tw/application/UTK02/UTK0206_.aspx
is_event_page = False
if '/UTK02/UTK020' in url.upper():
if '.aspx' in url.lower():
if len(url.split('/'))==6:
is_event_page = True
# ignore "pay money" step.
if '/UTK02/UTK0207_.ASPX' in url.upper():
is_event_page = False
if is_event_page:
if is_event_page:
is_match_target_feature = True
is_finish_checkbox_click = await nodriver_ibon_ticket_agree(tab)
if is_finish_checkbox_click:
is_name_based = False
try:
html_body = await tab.get_content()
#print("html_body:",len(html_body))
if html_body:
if len(html_body) > 1024:
if '實名制' in html_body:
is_name_based = True
except Exception as exc:
#print(exc)
pass
if not is_name_based:
is_button_clicked = await nodriver_press_button(tab, 'a.btn.btn-pink.continue')
return ibon_dict
async def nodriver_facebook_main(tab, config_dict):
facebook_account = config_dict["advanced"]["facebook_account"].strip()
facebook_password = config_dict["advanced"]["facebook_password_plaintext"].strip()
if facebook_password == "":
facebook_password = util.decryptMe(config_dict["advanced"]["facebook_password"])
if len(facebook_account) > 4:
await nodriver_facebook_login(tab, facebook_account, facebook_password)
def get_nodriver_browser_args(): def get_nodriver_browser_args():
browser_args = [ browser_args = [
@ -1519,12 +1791,17 @@ async def nodriver_current_url(tab):
url = ''.join(url_array) url = ''.join(url_array)
return url, is_quit_bot return url, is_quit_bot
def nodriver_overwrite_prefs(conf, prefs_dict={}): def nodriver_overwrite_prefs(conf):
#print(conf.user_data_dir) #print(conf.user_data_dir)
prefs_filepath = os.path.join(conf.user_data_dir,"Default") prefs_filepath = os.path.join(conf.user_data_dir,"Default")
if not os.path.exists(prefs_filepath): if not os.path.exists(prefs_filepath):
os.mkdir(prefs_filepath) os.mkdir(prefs_filepath)
prefs_filepath = os.path.join(prefs_filepath,"Preferences") prefs_filepath = os.path.join(prefs_filepath,"Preferences")
prefs_dict = {
"credentials_enable_service": False,
"ack_existing_ntp_extensions": False,
"translate":{"enabled": False}}
prefs_dict["in_product_help"]={} prefs_dict["in_product_help"]={}
prefs_dict["in_product_help"]["snoozed_feature"]={} prefs_dict["in_product_help"]["snoozed_feature"]={}
prefs_dict["in_product_help"]["snoozed_feature"]["IPH_LiveCaption"]={} prefs_dict["in_product_help"]["snoozed_feature"]["IPH_LiveCaption"]={}
@ -1580,10 +1857,7 @@ async def main(args):
if not config_dict is None: if not config_dict is None:
sandbox = False sandbox = False
conf = get_extension_config(config_dict) conf = get_extension_config(config_dict)
prefs = {"credentials_enable_service": False, nodriver_overwrite_prefs(conf)
"ack_existing_ntp_extensions": False,
"translate":{"enabled": False}}
nodriver_overwrite_prefs(conf, prefs)
# PS: nodrirver run twice always cause error: # PS: nodrirver run twice always cause error:
# Failed to connect to browser # Failed to connect to browser
# One of the causes could be when you are running as root. # One of the causes could be when you are running as root.
@ -1614,6 +1888,8 @@ async def main(args):
tixcraft_dict["elapsed_time"]=None tixcraft_dict["elapsed_time"]=None
tixcraft_dict["is_popup_checkout"] = False tixcraft_dict["is_popup_checkout"] = False
tixcraft_dict["area_retry_count"]=0 tixcraft_dict["area_retry_count"]=0
tixcraft_dict["played_sound_ticket"] = False
tixcraft_dict["played_sound_order"] = False
# for kktix # for kktix
kktix_dict = {} kktix_dict = {}
@ -1718,7 +1994,7 @@ async def main(args):
tixcraft_family = True tixcraft_family = True
if tixcraft_family: if tixcraft_family:
tixcraft_dict, is_quit_bot = await nodriver_tixcraft_main(driver, url, config_dict, tixcraft_dict, ocr, Captcha_Browser) tixcraft_dict, is_quit_bot = await nodriver_tixcraft_main(tab, url, config_dict, tixcraft_dict, ocr, Captcha_Browser)
pass pass
if 'famiticket.com' in url: if 'famiticket.com' in url:
@ -1726,7 +2002,7 @@ async def main(args):
pass pass
if 'ibon.com' in url: if 'ibon.com' in url:
#ibon_dict = ibon_main(driver, url, config_dict, ibon_dict, ocr, Captcha_Browser) ibon_dict = await nodriver_ibon_main(tab, url, config_dict, ibon_dict, ocr, Captcha_Browser)
pass pass
kham_family = False kham_family = False
@ -1769,12 +2045,7 @@ async def main(args):
# for facebook # for facebook
facebook_login_url = 'https://www.facebook.com/login.php?' facebook_login_url = 'https://www.facebook.com/login.php?'
if url[:len(facebook_login_url)]==facebook_login_url: if url[:len(facebook_login_url)]==facebook_login_url:
facebook_account = config_dict["advanced"]["facebook_account"].strip() await nodriver_facebook_main(tab, config_dict)
facebook_password = config_dict["advanced"]["facebook_password_plaintext"].strip()
if facebook_password == "":
facebook_password = util.decryptMe(config_dict["advanced"]["facebook_password"])
if len(facebook_account) > 4:
await nodriver_facebook_login(tab, facebook_account, facebook_password)
def cli(): def cli():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(

View File

@ -69,7 +69,7 @@
"ticketplus_password_plaintext": "", "ticketplus_password_plaintext": "",
"chrome_extension": true, "chrome_extension": true,
"disable_adjacent_seat": false, "disable_adjacent_seat": false,
"hide_some_image": false, "hide_some_image": true,
"block_facebook_network": false, "block_facebook_network": false,
"headless": false, "headless": false,
"verbose": false, "verbose": false,

View File

@ -41,7 +41,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.03.26)" CONST_APP_VERSION = "MaxBot (2024.03.27)"
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"

View File

@ -82,8 +82,6 @@ var fillEventData = function(data) {
if(settings) { if(settings) {
auto_reload_page_interval = settings.advanced.auto_reload_page_interval; auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
} }
const rootElement = document.documentElement;
rootElement.remove();
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();
@ -103,7 +101,7 @@ var openWindow = function(url) {
} }
var fillPerformanceData = function(data) { var fillPerformanceData = function(data) {
console.log("eventPerfData:", data); //console.log("eventPerfData:", data);
performanceDataCache = data; performanceDataCache = data;
perfPriceListMap = new Map(); perfPriceListMap = new Map();
//selectedPerfId = null; //selectedPerfId = null;

View File

@ -1,16 +1,16 @@
function getHtmlDocName() { function getHtmlDocName() {
var pathname = location.pathname; var pathname = location.pathname;
var pathParts = pathname.split('/'); var pathParts = pathname.split('/');
if(pathParts.length >= 3) return pathParts[2]; if(pathParts.length >= 3) return pathParts[2];
return null; return null;
} }
function goToCityline(){ function goToCityline(){
window.location="https://www.cityline.com"; window.location="https://www.cityline.com";
} }
function setRetryUrl(requestUrl){ function setRetryUrl(requestUrl){
urlThrottler = requestUrl; urlThrottler = requestUrl;
} }
function startCountDownTimer() { function startCountDownTimer() {
@ -90,9 +90,6 @@ function begin()
} }
if(status=='ON') { if(status=='ON') {
const rootElement = document.documentElement;
rootElement.remove();
let target_interval = auto_reload_page_interval * 1000; let target_interval = auto_reload_page_interval * 1000;
setInterval(() => { setInterval(() => {
//retry(); //retry();

View File

@ -4,9 +4,9 @@ function begin()
const status_div = document.querySelector('#status'); const status_div = document.querySelector('#status');
let settings = JSON.parse(settings_div.innerHTML); let settings = JSON.parse(settings_div.innerHTML);
let status = status_div.innerHTML; let status = status_div.innerHTML;
console.log("msg"); //console.log("msg");
console.log(settings); //console.log(settings);
console.log(status); //console.log(status);
let auto_reload_page_interval = 0.0; let auto_reload_page_interval = 0.0;
if(settings) { if(settings) {
@ -19,10 +19,8 @@ function begin()
} }
if(status=='ON') { if(status=='ON') {
const rootElement = document.documentElement;
rootElement.remove();
setInterval(() => { setInterval(() => {
busyFor = 0; //var busyFor = 0;
reload(); reload();
}, auto_reload_page_interval * 1000); }, auto_reload_page_interval * 1000);
} }

View File

@ -122,8 +122,6 @@ function ibon_area_main() {
if(settings) { if(settings) {
auto_reload_page_interval = settings.advanced.auto_reload_page_interval; auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
} }
const rootElement = document.documentElement;
rootElement.remove();
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();

View File

@ -77,15 +77,13 @@ function ibon_detail_ajax_done(game_info)
} }
console.log("reload:"+reload); //console.log("reload:"+reload);
console.log("target_href:"+target_href); //console.log("target_href:"+target_href);
if(reload) { if(reload) {
let auto_reload_page_interval = 0.0; let auto_reload_page_interval = 0.0;
if(settings) { if(settings) {
auto_reload_page_interval = settings.advanced.auto_reload_page_interval; auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
} }
const rootElement = document.documentElement;
rootElement.remove();
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();

View File

@ -34,8 +34,6 @@ function ajax_return_done(data, real_event_id, real_session_id) {
auto_reload_page_interval = 0.7; auto_reload_page_interval = 0.7;
} }
//const rootElement = document.documentElement;
//rootElement.remove();
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();

View File

@ -418,5 +418,5 @@
] ]
} }
], ],
"version": "1.0.18" "version": "1.0.19"
} }