add promo code input for ticketmaster

master
CHUN YU YAO 2023-07-08 11:54:38 +08:00
parent 92af079920
commit 6a17f4a239
4 changed files with 24 additions and 13 deletions

View File

@ -53,7 +53,7 @@ import webbrowser
import argparse import argparse
import itertools import itertools
CONST_APP_VERSION = "MaxBot (2023.6.30)" CONST_APP_VERSION = "MaxBot (2023.07.01)"
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"
@ -2406,18 +2406,18 @@ def tixcraft_ticket_number_auto_fill(driver, select_obj, ticket_number):
return is_ticket_number_assigned return is_ticket_number_assigned
def get_tixcraft_question_text(driver): def get_div_text_by_selector(driver, my_css_selector):
form_select = None div_element = None
try: try:
form_select = driver.find_element(By.CSS_SELECTOR, '.zone-verify') div_element = driver.find_element(By.CSS_SELECTOR, my_css_selector)
except Exception as exc: except Exception as exc:
print("find verify textbox fail") print("find verify textbox fail")
pass pass
question_text = "" question_text = ""
if form_select is not None: if div_element is not None:
try: try:
question_text = form_select.text question_text = div_element.text
except Exception as exc: except Exception as exc:
print("get text fail") print("get text fail")
@ -2599,7 +2599,15 @@ def get_answer_list_from_user_guess_string(config_dict):
return local_array + online_array return local_array + online_array
def ticketmaster_promo(driver, config_dict, fail_list):
question_selector = '#promoBox'
return tixcraft_input_check_code(driver, config_dict, fail_list, question_selector)
def tixcraft_verify(driver, config_dict, fail_list): def tixcraft_verify(driver, config_dict, fail_list):
question_selector = '.zone-verify'
return tixcraft_input_check_code(driver, config_dict, fail_list, question_selector)
def tixcraft_input_check_code(driver, config_dict, fail_list, question_selector):
show_debug_message = True # debug. show_debug_message = True # debug.
show_debug_message = False # online show_debug_message = False # online
@ -2608,7 +2616,7 @@ def tixcraft_verify(driver, config_dict, fail_list):
answer_list = [] answer_list = []
question_text = get_tixcraft_question_text(driver) question_text = get_div_text_by_selector(driver, question_selector)
if len(question_text) > 0: if len(question_text) > 0:
write_question_to_file(question_text) write_question_to_file(question_text)
@ -2624,7 +2632,6 @@ def tixcraft_verify(driver, config_dict, fail_list):
break break
if show_debug_message: if show_debug_message:
print("answer_index:", answer_index)
print("inferred_answer_string:", inferred_answer_string) print("inferred_answer_string:", inferred_answer_string)
print("answer_list:", answer_list) print("answer_list:", answer_list)
@ -2633,7 +2640,7 @@ def tixcraft_verify(driver, config_dict, fail_list):
next_step_button_css = "" next_step_button_css = ""
submit_by_enter = True submit_by_enter = True
check_input_interval = 0.2 check_input_interval = 0.2
is_answer_sent, fail_list = fill_common_verify_form(driver, config_dict, inferred_answer_string, fail_list, input_text_css, next_step_button_css, submit_by_enter) is_answer_sent, fail_list = fill_common_verify_form(driver, config_dict, inferred_answer_string, fail_list, input_text_css, next_step_button_css, submit_by_enter, check_input_interval)
return fail_list return fail_list
@ -6829,7 +6836,6 @@ def ticketmaster_assign_ticket_number(driver, config_dict):
#print("find table#ticketPriceList fail", exc) #print("find table#ticketPriceList fail", exc)
ticketmaster_parse_zone_info(driver, config_dict) ticketmaster_parse_zone_info(driver, config_dict)
form_select = None form_select = None
if not table_select is None: if not table_select is None:
if show_debug_message: if show_debug_message:
@ -6972,8 +6978,12 @@ def tixcraft_main(driver, url, config_dict, tixcraft_dict, ocr, Captcha_Browser)
tixcraft_area_auto_select(driver, url, config_dict) tixcraft_area_auto_select(driver, url, config_dict)
else: else:
# area auto select is too difficult, skip in this version. # area auto select is too difficult, skip in this version.
tixcraft_dict["fail_promo_list"] = ticketmaster_promo(driver, config_dict, tixcraft_dict["fail_promo_list"])
ticketmaster_assign_ticket_number(driver, config_dict) ticketmaster_assign_ticket_number(driver, config_dict)
else:
tixcraft_dict["fail_promo_list"] = []
# https://ticketmaster.sg/ticket/check-captcha/23_blackpink/954/5/75 # https://ticketmaster.sg/ticket/check-captcha/23_blackpink/954/5/75
if '/ticket/check-captcha/' in url: if '/ticket/check-captcha/' in url:
domain_name = url.split('/')[2] domain_name = url.split('/')[2]
@ -11015,6 +11025,7 @@ def main(args):
# for tixcraft # for tixcraft
tixcraft_dict = {} tixcraft_dict = {}
tixcraft_dict["fail_list"]=[] tixcraft_dict["fail_list"]=[]
tixcraft_dict["fail_promo_list"]=[]
tixcraft_dict["is_popup_checkout"] = False tixcraft_dict["is_popup_checkout"] = False
# for kktix # for kktix

View File

@ -22,7 +22,7 @@ import base64
import threading import threading
import subprocess import subprocess
CONST_APP_VERSION = "MaxBot (2023.6.30)" CONST_APP_VERSION = "MaxBot (2023.07.01)"
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

@ -34,7 +34,7 @@ ssl._create_default_https_context = ssl._create_unverified_context
import socket import socket
CONST_APP_VERSION = "MaxBot (2023.6.30)" CONST_APP_VERSION = "MaxBot (2023.07.01)"
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"

View File

@ -28,7 +28,7 @@ import asyncio
import tornado import tornado
from tornado.web import Application from tornado.web import Application
CONST_APP_VERSION = "MaxBot (2023.6.30)" CONST_APP_VERSION = "MaxBot (2023.07.01)"
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt" CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"