1
1
"""
2
- Qimai Data (qimai.cn) is a mobile product intelligence and business analysis platform in China.
2
+ Qimai Data (qimai.cn) is a mobile product business analysis platform in China.
3
3
4
4
Get a dict of the app information for a given typename (free, paid, grossing) from https://www.qimai.cn
5
5
6
- DrissionPage is a simple encapsulation of the selenium package, which is continuously updated, and some of the code could be
7
- not compatible with the latest version of DrissionPage.
8
-
9
6
p.s. Current version of DrissionPage : 4.0.4.17
7
+ https://github.com/g1879/DrissionPage
10
8
"""
11
9
12
10
from DrissionPage import ChromiumPage
@@ -21,7 +19,7 @@ def login(page: ChromiumPage, username: str, password: str) -> bool:
21
19
page .ele (".submit" ).click ()
22
20
print ("Login successfully" )
23
21
return True
24
- except :
22
+ except KeyError :
25
23
print ("Login failed" )
26
24
page .close ()
27
25
return False
@@ -30,7 +28,8 @@ def login(page: ChromiumPage, username: str, password: str) -> bool:
30
28
return True
31
29
32
30
33
- def get_app_info (page : ChromiumPage , username : str , password : str , typename : str ) -> dict :
31
+ def get_app_info (page : ChromiumPage ,
32
+ username : str , password : str , typename : str ) -> dict :
34
33
# Clear the cache to avoid the login failure
35
34
page .clear_cache (cookies = True )
36
35
if login (page , username , password ):
@@ -82,11 +81,10 @@ def get_app_info(page: ChromiumPage, username: str, password: str, typename: str
82
81
}
83
82
84
83
else :
85
- dic = { " error" : " Login failed" }
84
+ return { ' error' : ' Login failed' }
86
85
87
86
return dic
88
87
89
-
90
88
if __name__ == "__main__" :
91
89
page = ChromiumPage ()
92
90
print (get_app_info (page , "YOUR USERNAME" , "YOUR PASSWORD" , "free" ))
0 commit comments