Skip to content

Commit

Permalink
2024-04-08, update for cityline
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Apr 16, 2024
1 parent dbe351f commit 70dd4b1
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 68 deletions.
2 changes: 1 addition & 1 deletion 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.06)"
CONST_APP_VERSION = "MaxBot (2024.04.08)"

CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
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.07)"
CONST_APP_VERSION = "MaxBot (2024.04.08)"

CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down
2 changes: 1 addition & 1 deletion kktix_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import util

CONST_APP_VERSION = "MaxBot (2024.04.07)"
CONST_APP_VERSION = "MaxBot (2024.04.08)"

CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json"
Expand Down
27 changes: 13 additions & 14 deletions nodriver_tixcraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
print(exc)
pass

CONST_APP_VERSION = "MaxBot (2024.04.07)"
CONST_APP_VERSION = "MaxBot (2024.04.08)"

CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down Expand Up @@ -1637,16 +1637,8 @@ async def nodriver_ibon_main(tab, url, config_dict, ocr, Captcha_Browser):


async def nodriver_cityline_auto_retry_access(tab, url, config_dict):
cookies = await tab.browser.cookies.get_all()
is_cookie_exist = False
for cookie in cookies:
if 'my-' in cookie.name:
cookie.value=""
break
await tab.browser.cookies.set_all(cookies)


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]
Expand Down Expand Up @@ -1699,10 +1691,8 @@ async def nodriver_cityline_auto_retry_access(tab, url, config_dict):
pass

# 刷太快, 會被封IP?
# must wait...
# must wait...? no need to wait.
auto_reload_page_interval = config_dict["advanced"]["auto_reload_page_interval"]
if auto_reload_page_interval <= 0.2:
auto_reload_page_interval = 0.2
if auto_reload_page_interval > 0:
time.sleep(auto_reload_page_interval)

Expand Down Expand Up @@ -1875,7 +1865,16 @@ async def nodriver_cityline_main(tab, url, config_dict):
cityline_dict["played_sound_ticket"] = False

if 'msg.cityline.com' in url or 'event.cityline.com' in url:
await nodriver_cityline_auto_retry_access(tab, url, config_dict)
is_dom_ready = False
try:
html_body = await tab.get_content()
if html_body:
if len(html_body) > 10240:
is_dom_ready = True
except Exception as exc:
pass
if is_dom_ready:
await nodriver_cityline_auto_retry_access(tab, url, config_dict)

if 'cityline.com/Login.html' in url:
cityline_account = config_dict["advanced"]["cityline_account"]
Expand Down
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
except Exception as exc:
pass

CONST_APP_VERSION = "MaxBot (2024.04.06)"
CONST_APP_VERSION = "MaxBot (2024.04.08)"

CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
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,2", "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.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*"]}
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,2", "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.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": ""}}
62 changes: 14 additions & 48 deletions webdriver/Maxbotplus_1.0.0/js/cityline_msg_front.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,36 @@ function begin()
if(status=='ON') {
let target_interval = auto_reload_page_interval * 1000;
setInterval(() => {
//retry();
//console.log("trigger");
let url = window.location.href;
if(url.indexOf('lang=TW') > -1) {
$(".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");
//url = url[0]+"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;
}
}
}
$(".eventposter").off();
if (typeof setRetryUrl !== "undefined") {
setRetryUrl(url);
setRetryUrl(window.location.href);
}
$(".btn_cta").prop('disabled', false);
//$(".btn_cta").prop('disabled', false).trigger("click");
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();
//goEvent();
remainTime = 0;
}
} else {
$("#btn-retry-en-1").prop('disabled', false).trigger("click");
//$("#btn-retry-en-1").prop('disabled', false).trigger("click");
}
}, target_interval);
}

if (typeof window.IsDuplicate !== "undefined") {
if(window.IsDuplicate()) {
window.IsDuplicate = function () {return false;};
document.getElementById("busy_zone").innerHTML = '<button id="btn-retry-en-1" class="btn_cta" type="button" disabled="disabled" onclick="javascript:goEvent()">請重試 Retry<span id="remainTime1"></span></button>';
setTimeout(startCountDownTimer, 1000);
}
}
}

function dom_ready()
Expand All @@ -71,36 +67,6 @@ myInterval = setInterval(() => {
dom_ready();
}, 100);

var ItemType = {
Session: 1,
Local: 2
};

var localStorageTabKey = 'my-application-browser-tab';
function SetItem(itemtype, val) {
switch (itemtype) {
case ItemType.Session:
window.name = val;
break;
case ItemType.Local:
setCookie(localStorageTabKey, val);
break;
}
}

function setCookie(name, value, days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}

setInterval(() => {
SetItem(ItemType.Local, "");
}, 100);

function getHtmlDocName() {
var pathname = location.pathname;
Expand Down

0 comments on commit 70dd4b1

Please sign in to comment.