2024-03-31, update for cityline

master
Your Name 2024-04-11 10:56:01 +08:00
parent 1293b2d47a
commit ff5b9bfcb8
10 changed files with 111 additions and 151 deletions

View File

@ -44,7 +44,7 @@ except Exception as exc:
print(exc)
pass
CONST_APP_VERSION = "MaxBot (2024.03.30)"
CONST_APP_VERSION = "MaxBot (2024.03.31)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -54,38 +54,39 @@ CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"
CONST_MAXBLOCK_EXTENSION_NAME = "Maxblockplus_1.0.0"
CONST_MAXBLOCK_EXTENSION_FILTER =[
"*google-analytics.com/*",
"*googletagmanager.com/*",
"*googletagservices.com/*",
"*lndata.com/*",
"*.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/*",
"*doubleclick.net/*",
"*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/*",
"*.ssp.hinet.net/*",
"*ticketmaster.sg/js/adblock*",
"*.googlesyndication.com/*",
"*treasuredata.com/*",
"*play.google.com/log?*",
"*www.youtube.com/youtubei/v1/player/heartbeat*",
"*tixcraft.com/js/analytics.js*",
"*ticketmaster.sg/js/adblock.js*",
"*img.uniicreative.com/*",
"*cdn.cookielaw.org/*",
"*tixcraft.com/js/custom.js*",
"*tixcraft.com/js/analytics.js*",
"*tixcraft.com/js/common.js*",
"*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*"]
"*tixcraft.com/js/custom.js*",
"*treasuredata.com/*",
"*www.youtube.com/youtubei/v1/player/heartbeat*",
]
CONST_CHROME_VERSION_NOT_MATCH_EN="Please download the WebDriver version to match your browser version."
CONST_CHROME_VERSION_NOT_MATCH_TW="請下載與您瀏覽器相同版本的WebDriver版本或更新您的瀏覽器版本。"

View File

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

View File

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

View File

@ -32,7 +32,7 @@ except Exception as exc:
print(exc)
pass
CONST_APP_VERSION = "MaxBot (2024.03.30)"
CONST_APP_VERSION = "MaxBot (2024.03.31)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -42,38 +42,39 @@ CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"
CONST_MAXBLOCK_EXTENSION_NAME = "Maxblockplus_1.0.0"
CONST_MAXBLOCK_EXTENSION_FILTER =[
"*google-analytics.com/*",
"*googletagmanager.com/*",
"*googletagservices.com/*",
"*lndata.com/*",
"*.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/*",
"*doubleclick.net/*",
"*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/*",
"*.ssp.hinet.net/*",
"*ticketmaster.sg/js/adblock*",
"*.googlesyndication.com/*",
"*treasuredata.com/*",
"*play.google.com/log?*",
"*www.youtube.com/youtubei/v1/player/heartbeat*",
"*tixcraft.com/js/analytics.js*",
"*ticketmaster.sg/js/adblock.js*",
"*img.uniicreative.com/*",
"*cdn.cookielaw.org/*",
"*tixcraft.com/js/custom.js*",
"*tixcraft.com/js/analytics.js*",
"*tixcraft.com/js/common.js*",
"*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*"]
"*tixcraft.com/js/custom.js*",
"*treasuredata.com/*",
"*www.youtube.com/youtubei/v1/player/heartbeat*",
]
CONST_CITYLINE_SIGN_IN_URL = "https://www.cityline.com/Login.html?targetUrl=https%3A%2F%2Fwww.cityline.com%2FEvents.html"
CONST_FAMI_SIGN_IN_URL = "https://www.famiticket.com.tw/Home/User/SignIn"
@ -1729,16 +1730,14 @@ def get_nodriver_browser_args():
]
return browser_args
def get_maxbot_plus_extension_path():
extension_path = "webdriver/Maxbotplus_1.0.0/"
if platform.system() == 'Windows':
extension_path = extension_path.replace("/","\\")
def get_maxbot_extension_path(extension_folder):
app_root = util.get_app_root()
extension_path = "webdriver"
extension_path = os.path.join(extension_path, extension_folder)
config_filepath = os.path.join(app_root, extension_path)
#print("config_filepath:", config_filepath)
# check extesion mainfest
# double check extesion mainfest
path = pathlib.Path(config_filepath)
if path.exists():
if path.is_dir():
@ -1746,27 +1745,6 @@ def get_maxbot_plus_extension_path():
for item in path.rglob("manifest.*"):
path = item.parent
#print("final path:", path)
return config_filepath
def get_maxbot_block_extension_path():
extension_path = "webdriver/Maxblockplus_1.0.0/"
if platform.system() == 'Windows':
extension_path = extension_path.replace("/","\\")
app_root = util.get_app_root()
config_filepath = os.path.join(app_root, extension_path)
#print("config_filepath:", config_filepath)
# check extesion mainfest
path = pathlib.Path(config_filepath)
if path.exists():
if path.is_dir():
#print("found extension dir")
for item in path.rglob("manifest.*"):
path = item.parent
#print("final path:", path)
return config_filepath
def get_extension_config(config_dict):
@ -1777,8 +1755,14 @@ def get_extension_config(config_dict):
browser_args.append('--proxy-server=%s' % config_dict["advanced"]["proxy_server_port"])
conf = Config(browser_args=browser_args, lang=default_lang, no_sandbox=no_sandbox, headless=config_dict["advanced"]["headless"])
if config_dict["advanced"]["chrome_extension"]:
conf.add_extension(get_maxbot_plus_extension_path())
conf.add_extension(get_maxbot_block_extension_path())
ext = get_maxbot_extension_path(CONST_MAXBOT_EXTENSION_NAME)
if len(ext) > 0:
conf.add_extension(ext)
util.dump_settings_to_maxbot_plus_extension(ext, config_dict, CONST_MAXBOT_CONFIG_FILE)
ext = get_maxbot_extension_path(CONST_MAXBLOCK_EXTENSION_NAME)
if len(ext) > 0:
conf.add_extension(ext)
util.dump_settings_to_maxblock_plus_extension(ext, config_dict, CONST_MAXBOT_CONFIG_FILE, CONST_MAXBLOCK_EXTENSION_FILTER)
return conf
async def nodrver_block_urls(tab, config_dict):
@ -1903,8 +1887,8 @@ def nodriver_overwrite_prefs(conf):
prefs_dict["net"]["network_prediction_options"]=3
prefs_dict["privacy_guide"]={}
prefs_dict["privacy_guide"]["viewed"]=True
prefs_dict["privacy_sandbox"]={}
prefs_dict["privacy_sandbox"]["first_party_sets_enabled"]=False
#prefs_dict["privacy_sandbox"]={}
#prefs_dict["privacy_sandbox"]["first_party_sets_enabled"]=False
prefs_dict["profile"]={}
prefs_dict["profile"]["cookie_controls_mode"]=1
prefs_dict["profile"]["default_content_setting_values"]={}

View File

@ -41,7 +41,7 @@ try:
except Exception as exc:
pass
CONST_APP_VERSION = "MaxBot (2024.03.30)"
CONST_APP_VERSION = "MaxBot (2024.03.31)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -1130,8 +1130,11 @@ def launch_maxbot():
launch_counter += 1
else:
launch_counter = 0
webdriver_type = ""
global combo_webdriver_type
webdriver_type = combo_webdriver_type.get().strip()
if 'combo_webdriver_type' in globals():
webdriver_type = combo_webdriver_type.get().strip()
script_name = "chrome_tixcraft"
if webdriver_type == CONST_WEBDRIVER_TYPE_NODRIVER:
@ -1536,6 +1539,11 @@ def showHideBlocks():
BLOCK_STYLE_KKTIX = 1
STYLE_KKTIX_DOMAIN_LIST = ['kktix']
global combo_webdriver_type
if 'combo_webdriver_type' in globals():
if 'cityline.com' in new_homepage:
combo_webdriver_type.set("nodriver")
show_block_index = BLOCK_STYLE_TIXCRAFT
for domain_name in STYLE_KKTIX_DOMAIN_LIST:
if domain_name in new_homepage:
@ -2465,13 +2473,13 @@ def AutofillTab(root, config_dict, language_code, UI_PADDING_X):
global txt_cityline_account
txt_cityline_account_value = StringVar(frame_group_header, value=config_dict["advanced"]["cityline_account"].strip())
txt_cityline_account = Entry(frame_group_header, width=15, textvariable = txt_cityline_account_value)
txt_cityline_account.grid(column=1, row=group_row_count, sticky = W)
txt_cityline_account = Entry(frame_group_header, width=30, textvariable = txt_cityline_account_value)
txt_cityline_account.grid(column=1, row=group_row_count, sticky = W, columnspan=2)
global txt_cityline_password
txt_cityline_password_value = StringVar(frame_group_header, value=util.decryptMe(config_dict["advanced"]["cityline_password"].strip()))
txt_cityline_password = Entry(frame_group_header, width=15, textvariable = txt_cityline_password_value, show="*")
txt_cityline_password.grid(column=2, row=group_row_count, sticky = W)
#txt_cityline_password.grid(column=2, row=group_row_count, sticky = W)
group_row_count +=1

11
util.py
View File

@ -473,11 +473,12 @@ def dump_settings_to_maxbot_plus_extension(ext, config_dict, CONST_MAXBOT_CONFIG
if len(local_remote_url_array) > 0:
is_manifest_changed = False
for remote_url_final in local_remote_url_array:
if not remote_url_final in manifest_dict["host_permissions"]:
#print("local remote_url not in manifest:", remote_url_final)
manifest_dict["host_permissions"].append(remote_url_final)
is_manifest_changed = True
if 'host_permissions' in manifest_dict:
for remote_url_final in local_remote_url_array:
if not remote_url_final in manifest_dict["host_permissions"]:
#print("local remote_url not in manifest:", remote_url_final)
manifest_dict["host_permissions"].append(remote_url_final)
is_manifest_changed = True
if is_manifest_changed:
json_str = json.dumps(manifest_dict, indent=4)

View File

@ -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": ["*google-analytics.com/*", "*googletagmanager.com/*", "*googletagservices.com/*", "*lndata.com/*", "*a.amnet.tw/*", "*adx.c.appier.net/*", "*clarity.ms/*", "*cloudfront.com/*", "*cms.analytics.yahoo.com/*", "*doubleclick.net/*", "*e2elog.fetnet.net/*", "*fundingchoicesmessages.google.com/*", "*ghtinc.com/*", "*match.adsrvr.org/*", "*onead.onevision.com.tw/*", "*popin.cc/*", "*rollbar.com/*", "*sb.scorecardresearch.com/*", "*tagtoo.co/*", "*.ssp.hinet.net/*", "*ticketmaster.sg/js/adblock*", "*.googlesyndication.com/*", "*treasuredata.com/*", "*play.google.com/log?*", "*www.youtube.com/youtubei/v1/player/heartbeat*", "*tixcraft.com/js/analytics.js*", "*ticketmaster.sg/js/adblock.js*", "*img.uniicreative.com/*", "*cdn.cookielaw.org/*", "*tixcraft.com/js/custom.js*", "*tixcraft.com/js/common.js*", "*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*"]}
{"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*"]}

View File

@ -458,3 +458,10 @@ var doLikeThisEvent = function(evtId) {
});
}
}
/*
var url = contextPath + "/[activityCode]/performance?event=[eventId]&perfId=[perfId]";
url = url.replace("[activityCode]",activityCode)
.replace("[eventId]", eventId)
.replace("[perfId]",selectedPerfId)
location.href = url;
*/

View File

@ -1,73 +1,3 @@
function getHtmlDocName() {
var pathname = location.pathname;
var pathParts = pathname.split('/');
if(pathParts.length >= 3) return pathParts[2];
return null;
}
function goToCityline(){
window.location="https://www.cityline.com";
}
function setRetryUrl(requestUrl){
urlThrottler = requestUrl;
}
function startCountDownTimer() {
setRetryUrl(window.location.href);
if (enableAutoRetry){
setRemainTime(remainTime);
if (ddsScheduler == undefined) {
ddsScheduler = setInterval(function(){
updateRemainTime();
}, 1000);
}
}else{
document.getElementById("remainTime1").innerHTML = '';
$('#btn-retry-en-1').removeAttr('disabled');
}
}
function setRemainTime(sec) {
document.getElementById("remainTime1").innerHTML = '(' +sec+ ')';
}
function goEvent(){
window.location.href = urlThrottler;
}
/*
function goEvent(){
if(urlThrottler) {
if(window.location.href.indexOf("https://msg.cityline.com/") > -1) {
if(urlThrottler == "https://event.cityline.com") {
if(window.location.href.indexOf("?") > -1) {
urlThrottler = "https://event.cityline.com/queue?" + window.location.href.split("?")[1];
}
document.getElementById("multiple_tab_layout").innerHTML = '';
$('#busy_zone').removeClass('d-none')
document.getElementById("busy_zone").innerHTML = '<div class="event"><button id="btn-retry-en-1" class="btn_cta" type="button" onclick="javascript:goEvent()">請重試 Retry<span id="remainTime1"></span></button></div>';
var ddsScheduler = undefined;
setRemainTime(remainTime);
if (ddsScheduler == undefined) {
ddsScheduler = setInterval(function(){
updateRemainTime();
}, 1000);
}
}
}
if(urlThrottler.indexOf("?") > -1) {
document.getElementById("multiple_tab_layout").innerHTML = urlThrottler;
window.location.href = urlThrottler;
}
}
}
*/
function begin()
{
let settings = JSON.parse($("#settings").html());
@ -86,7 +16,7 @@ function begin()
// too short to cause error.
if(auto_reload_page_interval < 0.05) {
auto_reload_page_interval = 0.05;
auto_reload_page_interval = 0.1;
}
if(status=='ON') {
@ -94,7 +24,17 @@ function begin()
setInterval(() => {
//retry();
//console.log("trigger");
$(".btn_cta").prop('disabled', false).trigger("click");
$(".eventposter").off();
setRetryUrl(window.location.href);
$(".btn_cta").prop('disabled', false);
if (ddsScheduler != undefined)
clearInterval(ddsScheduler);
//$(".btn_cta").prop('disabled', false).trigger("click");
if (typeof goEvent !== "undefined") {
if(location.href.indexOf('home?') > -1) {
goEvent();
}
}
}, target_interval);
}
@ -151,3 +91,22 @@ setInterval(() => {
SetItem(ItemType.Local, "");
}, 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();
}
$(".eventposter").off();
if (typeof goEvent !== "undefined") {
if(location.href.indexOf('home?') > -1) {
//goEvent();
} else {
history.back();
}
}

View File

@ -334,7 +334,7 @@
},
{
"matches": [
"https://*.cityline.com/utsvInternet/internet/eventDetail?event=*",
"https://*.cityline.com/utsvInternet/*/eventDetail?event=*",
"https://*.cityline.com/utsvlnternet/*/login?lang=TW"
],
"run_at": "document_end",
@ -419,5 +419,5 @@
]
}
],
"version": "1.0.20"
"version": "1.0.21"
}