add kktix auto sign-in sign-out
parent
60f83872ed
commit
4ca9e4f066
|
@ -117,8 +117,7 @@ async def kktix_signin_nodriver(kktix_account, kktix_password):
|
|||
driver = await uc.start()
|
||||
profile_url = "https://kktix.com/users/edit"
|
||||
signin_url = "https://kktix.com/users/sign_in"
|
||||
signout_url = "https://kktix.com/users/sign_out"
|
||||
|
||||
#signout_url = "https://kktix.com/users/sign_out"
|
||||
|
||||
while True:
|
||||
try:
|
||||
|
@ -127,6 +126,10 @@ async def kktix_signin_nodriver(kktix_account, kktix_password):
|
|||
#await tab.sleep(0.1)
|
||||
#print(html)
|
||||
|
||||
x = await tab.js_dumps('window')
|
||||
#print(x)
|
||||
#print(x["location"]["href"])
|
||||
if x["location"]["href"]=="signin_url":
|
||||
account = await tab.select("#user_login")
|
||||
await account.send_keys(kktix_account)
|
||||
#await tab.sleep(0.1)
|
||||
|
@ -138,10 +141,17 @@ async def kktix_signin_nodriver(kktix_account, kktix_password):
|
|||
submit = await tab.select("input[type='submit'][name]")
|
||||
await submit.click()
|
||||
|
||||
await tab.sleep(0.3)
|
||||
tab = await driver.get(signout_url)
|
||||
await tab.sleep(0.3)
|
||||
await tab.sleep(0.5)
|
||||
#tab = await tab.get(signout_url)
|
||||
|
||||
signout = await tab.select("a[href='/users/sign_out']")
|
||||
await signout.click()
|
||||
await tab.sleep(0.5)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
if str(e)=="coroutine raised StopIteration":
|
||||
break
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ URL_CHROME_DRIVER = 'https://chromedriver.chromium.org/'
|
|||
URL_FIREFOX_DRIVER = 'https://github.com/mozilla/geckodriver/releases'
|
||||
URL_EDGE_DRIVER = 'https://developer.microsoft.com/zh-tw/microsoft-edge/tools/webdriver/'
|
||||
|
||||
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
|
||||
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
|
||||
|
||||
def load_translate():
|
||||
translate = {}
|
||||
|
|
Loading…
Reference in New Issue