2023-02-04, remove hkticketing from list.

master
CHUN YU YAO 2023-02-05 22:10:57 +08:00
parent e091faee33
commit abc754d94d
2 changed files with 46 additions and 9 deletions

View File

@ -51,7 +51,7 @@ except Exception as exc:
import ssl import ssl
ssl._create_default_https_context = ssl._create_unverified_context ssl._create_default_https_context = ssl._create_unverified_context
CONST_APP_VERSION = u"MaxBot (2023.02.03)" CONST_APP_VERSION = u"MaxBot (2023.02.04)"
CONST_HOMEPAGE_DEFAULT = "https://tixcraft.com" CONST_HOMEPAGE_DEFAULT = "https://tixcraft.com"
@ -5777,12 +5777,14 @@ def hkticketing_date_auto_select(driver, auto_select_mode, date_keyword, auto_re
print("click target_area link fail") print("click target_area link fail")
print(exc) print(exc)
# use plan B # use plan B
'''
try: try:
print("force to click by js.") print("force to click by js.")
driver.execute_script("arguments[0].click();", target_area) driver.execute_script("arguments[0].click();", target_area)
is_date_assigned = True is_date_assigned = True
except Exception as exc: except Exception as exc:
pass pass
'''
# alway, auto submit # alway, auto submit
el_btn = None el_btn = None
@ -5800,12 +5802,14 @@ def hkticketing_date_auto_select(driver, auto_select_mode, date_keyword, auto_re
ret = True ret = True
except Exception as exc: except Exception as exc:
# use plan B # use plan B
'''
try: try:
print("force to click by js.") print("force to click by js.")
driver.execute_script("arguments[0].click();", el_btn) driver.execute_script("arguments[0].click();", el_btn)
ret = True ret = True
except Exception as exc: except Exception as exc:
pass pass
'''
else: else:
if auto_reload_coming_soon_page_enable: if auto_reload_coming_soon_page_enable:
# auto refresh for date list page. # auto refresh for date list page.
@ -6232,6 +6236,27 @@ def hkticketing_performance(driver, config_dict, domain_name):
return is_price_assign_by_bot return is_price_assign_by_bot
def hkticketing_escape_robot_detection(driver):
ret = False
el_main_iframe = None
try:
el_main_iframe = driver.find_element(By.ID, 'main-iframe')
except Exception as exc:
print("find el_main_iframe fail...")
#print(exc)
pass
if el_main_iframe is not None:
print("bingo, found el_main_iframe, start to escape")
entry_url="https://queue.hkticketing.com/hotshow.html"
try:
driver.get(entry_url)
except Exception as exc:
print(exc)
return ret
def hkticketing_main(driver, url, config_dict): def hkticketing_main(driver, url, config_dict):
home_url_list = ['https://premier.hkticketing.com/' home_url_list = ['https://premier.hkticketing.com/'
@ -6261,14 +6286,18 @@ def hkticketing_main(driver, url, config_dict):
date_auto_select_enable = config_dict["tixcraft"]["date_auto_select"]["enable"] date_auto_select_enable = config_dict["tixcraft"]["date_auto_select"]["enable"]
if date_auto_select_enable: if date_auto_select_enable:
hkticketing_show(driver, config_dict) hkticketing_show(driver, config_dict)
pass
# https://premier.hkticketing.com/events/XXX/venues/KSH/performances/XXX/tickets # https://premier.hkticketing.com/events/XXX/venues/KSH/performances/XXX/tickets
if '/events/' in url and '/performances/' in url: if '/events/' in url and '/performances/' in url:
robot_detection = hkticketing_escape_robot_detection(driver)
if '/tickets' in url: if '/tickets' in url:
domain_name = url.split('/')[2] domain_name = url.split('/')[2]
area_auto_select_enable = config_dict["tixcraft"]["area_auto_select"]["enable"] area_auto_select_enable = config_dict["tixcraft"]["area_auto_select"]["enable"]
if area_auto_select_enable: if area_auto_select_enable:
hkticketing_performance(driver, config_dict, domain_name) hkticketing_performance(driver, config_dict, domain_name)
pass
if '/seatmap' in url: if '/seatmap' in url:
# goto bottom. # goto bottom.
@ -7171,17 +7200,22 @@ def main():
print('NoSuchWindowException at this url:', url ) print('NoSuchWindowException at this url:', url )
#print("last_url:", last_url) #print("last_url:", last_url)
#print("get_log:", driver.get_log('driver')) #print("get_log:", driver.get_log('driver'))
window_handles_count = 0
try:
window_handles_count = len(driver.window_handles)
#print("window_handles_count:", window_handles_count)
if window_handles_count >= 1:
driver.switch_to.window(driver.window_handles[0])
driver.switch_to.default_content()
else:
if DISCONNECTED_MSG in driver.get_log('driver')[-1]['message']: if DISCONNECTED_MSG in driver.get_log('driver')[-1]['message']:
print('quit bot by NoSuchWindowException') print('quit bot by NoSuchWindowException')
driver.quit() driver.quit()
sys.exit() sys.exit()
break break
try:
window_handles_count = len(driver.window_handles)
if window_handles_count > 1:
driver.switch_to.window(driver.window_handles[0])
except Exception as excSwithFail: except Exception as excSwithFail:
pass pass
except UnexpectedAlertPresentException as exc1: except UnexpectedAlertPresentException as exc1:
# PS: DON'T remove this line. # PS: DON'T remove this line.
is_verifyCode_editing = False is_verifyCode_editing = False

View File

@ -19,7 +19,7 @@ import json
import webbrowser import webbrowser
import pyperclip import pyperclip
CONST_APP_VERSION = u"MaxBot (2023.02.03)" CONST_APP_VERSION = u"MaxBot (2023.02.04)"
CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom" CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom"
CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top" CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top"
@ -1096,9 +1096,12 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
,"https://kham.com.tw/ (寬宏)" ,"https://kham.com.tw/ (寬宏)"
,"http://www.urbtix.hk/ (城市)" ,"http://www.urbtix.hk/ (城市)"
,"https://www.cityline.com/ (買飛)" ,"https://www.cityline.com/ (買飛)"
,"https://premier.hkticketing.com/ (快達票)"
,"https://ticketing.galaxymacau.com/ (澳門銀河)" ,"https://ticketing.galaxymacau.com/ (澳門銀河)"
] ]
# 目前機器人已失效, 因為官方的 reCaptcha 可以檢測出機器人。
'''
,"https://premier.hkticketing.com/ (快達票)"
'''
combo_homepage.set(homepage) combo_homepage.set(homepage)
combo_homepage.bind("<<ComboboxSelected>>", callbackHomepageOnChange) combo_homepage.bind("<<ComboboxSelected>>", callbackHomepageOnChange)
combo_homepage.grid(column=1, row=group_row_count, sticky = W) combo_homepage.grid(column=1, row=group_row_count, sticky = W)