citylinle allow to sign in with nodriver.
parent
e15b9a0380
commit
e6ef9fdf56
|
@ -6674,7 +6674,6 @@ def cityline_cookie_accept(driver):
|
|||
is_btn_click = press_button(driver, By.CSS_SELECTOR,'.cookieWrapper_closeBtn')
|
||||
|
||||
def cityline_auto_retry_access(driver, config_dict):
|
||||
btn_retry = None
|
||||
try:
|
||||
btn_retry = driver.find_element(By.CSS_SELECTOR, 'button')
|
||||
if not btn_retry is None:
|
||||
|
@ -6689,26 +6688,6 @@ def cityline_auto_retry_access(driver, config_dict):
|
|||
if config_dict["advanced"]["auto_reload_page_interval"] > 0:
|
||||
time.sleep(config_dict["advanced"]["auto_reload_page_interval"])
|
||||
|
||||
def cityline_go_venue(driver, url):
|
||||
url_https = url.replace("http://","https://")
|
||||
url_https_array = url_https.split("/")
|
||||
|
||||
is_match_venue_url = False
|
||||
if url[-1:] == "/":
|
||||
if len(url_https_array)==4:
|
||||
domain_array = url_https_array[2].split(".")
|
||||
if len(domain_array)==3:
|
||||
is_match_venue_url = True
|
||||
|
||||
if is_match_venue_url:
|
||||
try:
|
||||
btn_next = driver.find_element(By.CSS_SELECTOR, 'div#eventDetail > div#btnDiv > a')
|
||||
if not btn_next is None:
|
||||
driver.set_script_timeout(1)
|
||||
driver.execute_script("go_venue('TW');")
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
def cityline_clean_ads(driver):
|
||||
ad_query_list = [
|
||||
'ats-overlay-bottom-wrapper-rendered',
|
||||
|
@ -6777,7 +6756,6 @@ def cityline_main(driver, url, config_dict):
|
|||
if '.cityline.com/Events.html' in url:
|
||||
cityline_cookie_accept(driver)
|
||||
|
||||
cityline_go_venue(driver, url)
|
||||
cityline_clean_ads(driver)
|
||||
|
||||
if 'cityline.com/queue?' in url:
|
||||
|
@ -6786,7 +6764,7 @@ def cityline_main(driver, url, config_dict):
|
|||
|
||||
# https://www.cityline.com/Login.html?targetUrl=https%3A%2F%2F
|
||||
# ignore url redirect
|
||||
if '.com/Login.html' in url:
|
||||
if 'cityline.com/Login.html' in url:
|
||||
cityline_account = config_dict["advanced"]["cityline_account"]
|
||||
cityline_password = config_dict["advanced"]["cityline_password_plaintext"].strip()
|
||||
if cityline_password == "":
|
||||
|
|
|
@ -1271,7 +1271,7 @@ async def nodriver_ticketplus_account_auto_fill(tab, config_dict):
|
|||
print(exc)
|
||||
pass
|
||||
|
||||
print("is_sign_in_btn_pressed", is_sign_in_btn_pressed)
|
||||
#print("is_sign_in_btn_pressed", is_sign_in_btn_pressed)
|
||||
if not is_sign_in_btn_pressed:
|
||||
#print("rwd mode")
|
||||
action_btns = None
|
||||
|
@ -1595,9 +1595,80 @@ async def nodriver_ibon_main(tab, url, config_dict, ibon_dict, ocr, Captcha_Brow
|
|||
|
||||
if not is_name_based:
|
||||
is_button_clicked = await nodriver_press_button(tab, 'a.btn.btn-pink.continue')
|
||||
|
||||
return ibon_dict
|
||||
|
||||
|
||||
async def nodriver_cityline_auto_retry_access(tab, url):
|
||||
try:
|
||||
btn_retry = await tab.query_selector('button')
|
||||
if btn_retry:
|
||||
btn_retry.click()
|
||||
except Exception as exc:
|
||||
print(exc)
|
||||
pass
|
||||
|
||||
# 刷太快, 會被封IP?
|
||||
# must 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)
|
||||
|
||||
async def nodriver_cityline_login(tab, cityline_account):
|
||||
global is_cityline_account_assigned
|
||||
if not 'is_cityline_account_assigned' in globals():
|
||||
is_cityline_account_assigned = False
|
||||
|
||||
#print("is_cityline_account_assigned", is_cityline_account_assigned)
|
||||
if not is_cityline_account_assigned:
|
||||
try:
|
||||
#await tab.verify_cf()
|
||||
el_account = await tab.query_selector('input[type="text"]')
|
||||
if el_account:
|
||||
await el_account.click()
|
||||
await el_account.apply('function (element) {element.value = ""; } ')
|
||||
await el_account.send_keys(cityline_account);
|
||||
time.sleep(0.5)
|
||||
is_cityline_account_assigned = True
|
||||
except Exception as exc:
|
||||
print(exc)
|
||||
pass
|
||||
else:
|
||||
# after account inputed.
|
||||
try:
|
||||
#is_checkbox_checked = await nodriver_check_checkbox(tab, 'span.ant-checkbox input[type="checkbox"]')
|
||||
#print("is_checkbox_checked", is_checkbox_checked)
|
||||
# jquery solution.
|
||||
#js="$('input:checkbox').prop('checked', true);"
|
||||
# javascript solution.
|
||||
#js = "for (const checkbox of document.querySelectorAll('input[type=checkbox]:not(:checked)')) { checkbox.checked = true;}"
|
||||
#await tab.evaluate(js)
|
||||
checkbox_readed = await tab.query_selector('input[type=checkbox]:not(:checked)')
|
||||
if checkbox_readed:
|
||||
print("click on readed.")
|
||||
await checkbox_readed.click()
|
||||
time.sleep(0.5)
|
||||
except Exception as exc:
|
||||
print(exc)
|
||||
pass
|
||||
|
||||
|
||||
async def nodriver_cityline_main(tab, url, config_dict):
|
||||
if 'msg.cityline.com' in url or 'event.cityline.com' in url:
|
||||
await nodriver_cityline_auto_retry_access(tab, url)
|
||||
|
||||
if 'cityline.com/Login.html' in url:
|
||||
cityline_account = config_dict["advanced"]["cityline_account"]
|
||||
if len(cityline_account) > 4:
|
||||
await nodriver_cityline_login(tab, cityline_account)
|
||||
|
||||
# main page:
|
||||
# TODO:
|
||||
#https://venue.cityline.com/utsvInternet/EVENT_NAME/performance?event=EVENT_CODE&perfId=PROFORMANCE_ID
|
||||
pass
|
||||
|
||||
|
||||
async def nodriver_facebook_main(tab, config_dict):
|
||||
facebook_account = config_dict["advanced"]["facebook_account"].strip()
|
||||
facebook_password = config_dict["advanced"]["facebook_password_plaintext"].strip()
|
||||
|
@ -1701,7 +1772,10 @@ def get_maxbot_block_extension_path():
|
|||
def get_extension_config(config_dict):
|
||||
default_lang = "zh-TW"
|
||||
no_sandbox=True
|
||||
conf = Config(browser_args=get_nodriver_browser_args(), lang=default_lang, no_sandbox=no_sandbox, headless=config_dict["advanced"]["headless"])
|
||||
browser_args = get_nodriver_browser_args()
|
||||
if len(config_dict["advanced"]["proxy_server_port"]) > 2:
|
||||
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())
|
||||
|
@ -2043,7 +2117,7 @@ async def main(args):
|
|||
pass
|
||||
|
||||
if 'cityline.com' in url:
|
||||
#cityline_main(driver, url, config_dict)
|
||||
await nodriver_cityline_main(tab, url, config_dict)
|
||||
pass
|
||||
|
||||
softix_family = False
|
||||
|
|
Loading…
Reference in New Issue