Skip to content

Commit

Permalink
2024-04-13, update cityline
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Apr 30, 2024
1 parent da2a83c commit f8672be
Show file tree
Hide file tree
Showing 28 changed files with 1,126 additions and 139 deletions.
5 changes: 3 additions & 2 deletions chrome_tixcraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
print(exc)
pass

CONST_APP_VERSION = "MaxBot (2024.04.12)"
CONST_APP_VERSION = "MaxBot (2024.04.13)"

CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down Expand Up @@ -6746,7 +6746,8 @@ def cityline_close_second_tab(driver):
def cityline_main(driver, url, config_dict):
# https://msg.cityline.com/ https://event.cityline.com/
if 'msg.cityline.com' in url or 'event.cityline.com' in url:
cityline_auto_retry_access(driver, config_dict)
#cityline_auto_retry_access(driver, config_dict)
pass

cityline_close_second_tab(driver)

Expand Down
2 changes: 1 addition & 1 deletion config_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import util

CONST_APP_VERSION = "MaxBot (2024.04.12)"
CONST_APP_VERSION = "MaxBot (2024.04.13)"

CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down
57 changes: 7 additions & 50 deletions nodriver_tixcraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
print(exc)
pass

CONST_APP_VERSION = "MaxBot (2024.04.12)"
CONST_APP_VERSION = "MaxBot (2024.04.13)"

CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down Expand Up @@ -263,6 +263,7 @@ async def nodriver_goto_homepage(driver, config_dict):
# for like human.
try:
tab = await driver.get(homepage)
await tab.get_content()
time.sleep(5)
except Exception as e:
pass
Expand Down Expand Up @@ -302,6 +303,7 @@ async def nodriver_goto_homepage(driver, config_dict):

try:
tab = await driver.get(homepage)
await tab.get_content()
time.sleep(3)
except Exception as e:
pass
Expand Down Expand Up @@ -1657,55 +1659,9 @@ async def nodriver_ibon_main(tab, url, config_dict, ocr, Captcha_Browser):


async def nodriver_cityline_auto_retry_access(tab, url, config_dict):
cityline_event_url = "https://event.cityline.com/"
# from loc redirect.
if "?loc=" in url:
url = url.replace("%3Flang%3DTW%26lang%3DTW","%3Flang%3DTW")
loc = url.split("?loc=")[1]
if len(loc) > 0:
if "&" in loc:
loc = url.split("&")[0]
loc_decode = urllib.parse.unquote(loc)
if len(loc_decode) > 0:
if loc_decode[:1]=="/":
loc_decode = loc_decode[1:]
if loc_decode[:6] != "https:":
new_url = cityline_event_url + loc_decode
if not "&lang=" in new_url:
new_url = new_url + "&lang=TW"
new_url = new_url.replace("lang=TW&lang=TW","lang=TW")
if new_url != url:
try:
#print("old url:", url)
print("redirect to url:", new_url)
tab = await tab.get(new_url)
time.sleep(0.2)
pass
except Exception as e:
print(e)
pass

# https://event.cityline.com/utsvInternet/EVENT_NAME/home?lang=TW
if "lang=TW" in url:
url_array = url.split("lang=TW")
if len(url_array) > 2:
new_url = url_array[0] + "lang=TW"
if new_url != url:
try:
new_url = new_url.replace("lang=TW&lang=TW","lang=TW")
print("redirect to url:", new_url)
tab = await tab.get(new_url)
time.sleep(0.2)
except Exception as exc:
print(exc)
pass

try:
btn_retry = await tab.query_selector('button')
if btn_retry:
#print("found button to click.")
btn_retry.click()
time.sleep(0.2)
js = "goEvent();"
await tab.evaluate(js)
except Exception as exc:
print(exc)
pass
Expand Down Expand Up @@ -1894,7 +1850,8 @@ async def nodriver_cityline_main(tab, url, config_dict):
except Exception as exc:
pass
if is_dom_ready:
await nodriver_cityline_auto_retry_access(tab, url, config_dict)
#await nodriver_cityline_auto_retry_access(tab, url, config_dict)
pass

if 'cityline.com/Login.html' in url:
cityline_account = config_dict["advanced"]["cityline_account"]
Expand Down
2 changes: 1 addition & 1 deletion settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"auto_guess_options": true,
"user_guess_string": "",
"remote_url": "\"http://127.0.0.1:16888/\"",
"auto_reload_page_interval": 0.2,
"auto_reload_page_interval": 0.1,
"reset_browser_interval": 0,
"kktix_status_api": false,
"max_dwell_time": 60,
Expand Down
4 changes: 2 additions & 2 deletions settings.py → settings_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
except Exception as exc:
pass

CONST_APP_VERSION = "MaxBot (2024.04.12)"
CONST_APP_VERSION = "MaxBot (2024.04.13)"

CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down Expand Up @@ -2745,7 +2745,7 @@ def check_maxbot_config_unsaved(config_dict):

def settgins_gui_timer():
while True:
btn_preview_text_clicked()
#btn_preview_text_clicked()
preview_question_text_file()
update_maxbot_runtime_status()
change_maxbot_status_by_keyword()
Expand Down
2 changes: 1 addition & 1 deletion webdriver/Maxblockplus_1.0.0/data/settings.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_sound": {"ticket": true, "order": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "disable_adjacent_seat": false, "hide_some_image": false, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.0, "reset_browser_interval": 0, "kktix_status_api": false, "max_dwell_time": 60, "proxy_server_port": "", "window_size": "480,1024,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}, "domain_filter": ["*.doubleclick.net/*", "*.googlesyndication.com/*", "*.ssp.hinet.net/*", "*a.amnet.tw/*", "*adx.c.appier.net/*", "*cdn.cookielaw.org/*", "*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*", "*clarity.ms/*", "*cloudfront.com/*", "*cms.analytics.yahoo.com/*", "*e2elog.fetnet.net/*", "*fundingchoicesmessages.google.com/*", "*ghtinc.com/*", "*google-analytics.com/*", "*googletagmanager.com/*", "*googletagservices.com/*", "*img.uniicreative.com/*", "*lndata.com/*", "*match.adsrvr.org/*", "*onead.onevision.com.tw/*", "*play.google.com/log?*", "*popin.cc/*", "*rollbar.com/*", "*sb.scorecardresearch.com/*", "*tagtoo.co/*", "*ticketmaster.sg/js/adblock*", "*ticketmaster.sg/js/adblock.js*", "*tixcraft.com/js/analytics.js*", "*tixcraft.com/js/common.js*", "*tixcraft.com/js/custom.js*", "*treasuredata.com/*", "*www.youtube.com/youtubei/v1/player/heartbeat*"]}
{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_sound": {"ticket": true, "order": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "disable_adjacent_seat": false, "hide_some_image": false, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.1, "reset_browser_interval": 0, "kktix_status_api": false, "max_dwell_time": 60, "proxy_server_port": "", "window_size": "480,1024,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}, "domain_filter": ["*.doubleclick.net/*", "*.googlesyndication.com/*", "*.ssp.hinet.net/*", "*a.amnet.tw/*", "*adx.c.appier.net/*", "*cdn.cookielaw.org/*", "*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*", "*clarity.ms/*", "*cloudfront.com/*", "*cms.analytics.yahoo.com/*", "*e2elog.fetnet.net/*", "*fundingchoicesmessages.google.com/*", "*ghtinc.com/*", "*google-analytics.com/*", "*googletagmanager.com/*", "*googletagservices.com/*", "*img.uniicreative.com/*", "*lndata.com/*", "*match.adsrvr.org/*", "*onead.onevision.com.tw/*", "*play.google.com/log?*", "*popin.cc/*", "*rollbar.com/*", "*sb.scorecardresearch.com/*", "*tagtoo.co/*", "*ticketmaster.sg/js/adblock*", "*ticketmaster.sg/js/adblock.js*", "*tixcraft.com/js/analytics.js*", "*tixcraft.com/js/common.js*", "*tixcraft.com/js/custom.js*", "*treasuredata.com/*", "*www.youtube.com/youtubei/v1/player/heartbeat*"]}
2 changes: 1 addition & 1 deletion webdriver/Maxbotplus_1.0.0/data/settings.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_sound": {"ticket": true, "order": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "disable_adjacent_seat": false, "hide_some_image": false, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.0, "reset_browser_interval": 0, "kktix_status_api": false, "max_dwell_time": 60, "proxy_server_port": "", "window_size": "480,1024,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}}
{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_sound": {"ticket": true, "order": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "disable_adjacent_seat": false, "hide_some_image": false, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.1, "reset_browser_interval": 0, "kktix_status_api": false, "max_dwell_time": 60, "proxy_server_port": "", "window_size": "480,1024,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}}
62 changes: 3 additions & 59 deletions webdriver/Maxbotplus_1.0.0/js/cityline_msg_front.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,12 @@ function begin()
$("#settings").remove();
$("#status").remove();

let auto_reload_page_interval = 0.0;
if(settings) {
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
}

// too short to cause error.
if(auto_reload_page_interval < 0.1) {
auto_reload_page_interval = 0.1;
}

if(status=='ON') {
let target_interval = auto_reload_page_interval * 1000;
setInterval(() => {
$(".eventposter").off();
$(".btn_cta").prop('disabled', false);
if(location.href.indexOf('?loc=') > -1) {
if(location.href.indexOf('%2F') > -1) {
const myArray = url.split("lang=TW");
if(myArray.length >=3) {
if(myArray[1]=="utsvInternet") {
let new_url = "https://event.cityline.com/utsvInternet/"+myArray[1]+"/home?lang=TW";
location.href = new_url;
}
}
if (typeof remainTime !== "undefined") {
remainTime = 0;
}
if (typeof setRetryUrl !== "undefined") {
setRetryUrl(window.location.href);
}
if (typeof goEvent !== "undefined") {
let is_need_goEvent = false;
if(location.href.indexOf('home?') > -1) is_need_goEvent = true;
if(location.href.indexOf('?loc=') > -1) is_need_goEvent = true;
if(location.href.indexOf('lang=') > -1) is_need_goEvent = true;
if(is_need_goEvent) {
//goEvent();
remainTime = 0;
}
} else {
//$("#btn-retry-en-1").prop('disabled', false).trigger("click");
}
}, target_interval);
}, 3000);
}

}
Expand All @@ -67,24 +32,3 @@ myInterval = setInterval(() => {
dom_ready();
}, 100);


function getHtmlDocName() {
var pathname = location.pathname;
var pathParts = pathname.split('/');
if(pathParts.length >= 3) return pathParts[2];
return null;
}

if(getHtmlDocName()==null) {
history.back();
}
if (typeof goEvent !== "undefined") {
let is_need_back = true;
if(location.href.indexOf('home?') > -1) is_need_back = false;
if(location.href.indexOf('?loc=') > -1) is_need_back = false;
if(location.href.indexOf('lang=') > -1) is_need_back = false;
if (is_need_back) {
history.back();
}
}

12 changes: 7 additions & 5 deletions webdriver/Maxbotplus_1.0.0/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,9 @@
},
{
"matches": [
"https://msg.cityline.com/*.html*",
"https://*.cityline.com/utsvInternet/*/home?lang=TW",
"https://msg.cityline.com/*",
"https://event.cityline.com/utsvInternet/*/home?*",
"https://event.cityline.com/utsvInternet/*/login?*",
"https://event.cityline.com/",
"https://event.cityline.com/queue?loc=*"
],
Expand All @@ -341,8 +342,9 @@
},
{
"matches": [
"https://msg.cityline.com/*.html*",
"https://*.cityline.com/utsvInternet/*/home?lang=TW",
"https://msg.cityline.com/*",
"https://event.cityline.com/utsvInternet/*/home?*",
"https://event.cityline.com/utsvInternet/*/login?*",
"https://event.cityline.com/",
"https://event.cityline.com/queue?loc=*"
],
Expand Down Expand Up @@ -465,5 +467,5 @@
]
}
],
"version": "1.0.25"
"version": "1.0.26"
}

0 comments on commit f8672be

Please sign in to comment.