-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
48 lines (40 loc) · 1.31 KB
/
app.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
41
42
43
44
45
46
47
48
from gooey import Gooey,GooeyParser
import browser_cookie3
from src.client.base import registry
def retrieve_cookies_from_browser():
cj = browser_cookie3.chrome()
return cj
@Gooey(
program_name='WordsOut',
)
def main():
parser = GooeyParser()
parser.add_argument(
"--platform", help="which dictionary do you want export", choices=list(registry.keys()))
parser.add_argument(
"--cookies", help="cookie, which is set after you log in")
parser.add_argument(
"--admin", help="admin mode, which will access cookies from browser directly (only chrome is supported)", default=False,
widget="CheckBox",
action = "store_true",
)
args = parser.parse_args()
platform = args.platform
cookies_str = args.cookies
admin = args.admin
if admin:
try:
cookies_str = retrieve_cookies_from_browser()
except Exception as e:
print(f'some error happened, {e}, will use default cookies instead')
cookies_str = args.cookies
if not platform:
print("you didn't choose any platform to export!")
return
if not cookies_str:
print("cookies weren't set property!")
return
exporter = registry[platform]
exporter.export(cookies_str)
if __name__ == '__main__':
main()