tixcraft auto reload for coming soon event.

master
Max 2023-11-27 18:19:24 +08:00 committed by GitHub
parent ecb1612ea4
commit fc710a0b43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 15 deletions

View File

@ -55,7 +55,7 @@ import webbrowser
import chromedriver_autoinstaller import chromedriver_autoinstaller
CONST_APP_VERSION = "MaxBot (2023.11.20)" CONST_APP_VERSION = "MaxBot (2023.11.21)"
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"
@ -1831,7 +1831,24 @@ def tixcraft_date_auto_select(driver, url, config_dict, domain_name):
print("find #gameList fail") print("find #gameList fail")
is_coming_soon = False is_coming_soon = False
coming_soon_condictions_list_tw = ['開賣','剩餘','','小時','分鐘','','0',':','/'] coming_soon_condictions_list_en = [' day(s)', ' hrs.',' min',' sec',' till sale starts!','0',':','/']
coming_soon_condictions_list_tw = ['開賣','剩餘','',' 小時',' 分鐘','','0',':','/','20']
coming_soon_condictions_list_ja = ['発売開始', '', ' 時間','','','0',':','/','20']
coming_soon_condictions_list = coming_soon_condictions_list_en
html_lang="en-US"
try:
html_body = driver.page_source
if '<head' in html_body:
html = html_body.split("<head")[0]
html_lang = html.split('"')[1]
if show_debug_message:
print("html lang:" , html_lang)
if html_lang == "zh-TW":
coming_soon_condictions_list = coming_soon_condictions_list_tw
if html_lang == "ja":
coming_soon_condictions_list = coming_soon_condictions_list_ja
except Exception as e:
pass
matched_blocks = None matched_blocks = None
formated_area_list = None formated_area_list = None
@ -1861,6 +1878,20 @@ def tixcraft_date_auto_select(driver, url, config_dict, domain_name):
row_text = "" row_text = ""
if len(row_text) > 0: if len(row_text) > 0:
# check is coming soon events in list.
is_match_all_coming_soon_condiction = True
for condiction_string in coming_soon_condictions_list:
if not condiction_string in row_text:
is_match_all_coming_soon_condiction = False
break
if is_match_all_coming_soon_condiction:
if show_debug_message:
print("match coming soon condiction at row:", row_text)
is_coming_soon = True
break
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:
@ -1881,19 +1912,6 @@ def tixcraft_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
# check is coming soon.
if row_is_enabled:
is_match_all_coming_soon_condiction = True
for condiction_string in coming_soon_condictions_list_tw:
if not condiction_string in row_text:
is_match_all_coming_soon_condiction = False
break
if is_match_all_coming_soon_condiction:
if show_debug_message:
print("match coming soon condiction at row:", row_text)
is_coming_soon = True
break
if row_is_enabled: if row_is_enabled:
formated_area_list.append(row) formated_area_list.append(row)