-
Notifications
You must be signed in to change notification settings - Fork 6
/
sample2.py
40 lines (35 loc) · 1.68 KB
/
sample2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from TwitterFrontendFlow.TwitterFrontendFlow import TwitterFrontendFlow
flow = TwitterFrontendFlow()
flow.login_flow()
flow.LoginJsInstrumentationSubtask()
while "LoginSuccessSubtask" not in flow.get_subtask_ids():
try:
if "LoginEnterUserIdentifierSSO" in flow.get_subtask_ids():
print("Telephone number / Email address / User name")
flow.LoginEnterUserIdentifierSSO(input())
elif "LoginEnterAlternateIdentifierSubtask" in flow.get_subtask_ids():
print(flow.content["subtasks"][0]["enter_text"]["primary_text"]["text"])
flow.LoginEnterAlternateIdentifierSubtask(input())
elif "LoginEnterPassword" in flow.get_subtask_ids():
print(flow.content["subtasks"][0]["enter_password"]["primary_text"]["text"])
flow.LoginEnterPassword(input())
elif "AccountDuplicationCheck" in flow.get_subtask_ids():
print("AccountDuplicationCheck")
flow.AccountDuplicationCheck()
elif "LoginTwoFactorAuthChallenge" in flow.get_subtask_ids():
header = flow.content["subtasks"][0]["enter_text"]["header"]
print(header["primary_text"]["text"])
flow.LoginTwoFactorAuthChallenge(input())
elif "LoginAcid" in flow.get_subtask_ids():
header = flow.content["subtasks"][0]["enter_text"]["header"]
print(header["secondary_text"]["text"])
flow.LoginAcid(input())
elif "SuccessExit" in flow.get_subtask_ids():
break
else:
print("Non-supported login methods: " + flow.get_subtask_ids())
exit(1)
except:
print("Error")
print("Success")
flow.SaveCookies("cookie.json")