forked from Mzdyl/LiteLoaderQQNT_Install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_qqnt.py
57 lines (49 loc) · 1.27 KB
/
get_qqnt.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
49
50
51
52
53
54
55
56
57
from requests import get
from sys import exit, argv
# index2cdnjs
def get1(r):
r = get(r).text
r = r[r.find("var rainbowConfigUrl") :]
r = r[r.find('"') + 1 :]
r = r[: r.find('"')]
return r
# content2link
def get2(r, key):
r = r[r.find(key) :]
r = r[r.find('"') + 1 :]
r = r[r.find('"') + 1 :]
r = r[: r.find('"')]
return r
# get plat
plat = argv[1]
print("plat:%s" % plat)
# get link
if plat == "Windowsx64":
r = get2(
get(get1("https://im.qq.com/pcqq/index.shtml")).text,
"ntDownloadX64Url",
)
name = "QQInstaller.exe"
elif plat == "Debianx64":
r = get(get1("https://im.qq.com/linuxqq/index.shtml")).text
r = r[r.find("x64DownloadUrl") :]
r = get2(r[: r.find("}")], "deb")
name = "LinuxQQ.deb"
elif plat == "Macos":
r = get2(
get(get1("https://im.qq.com/macqq/index.shtml")).text,
"downloadUrl",
)
name = "QQ.dmg"
elif plat == "AppImage":
r = get(get1("https://im.qq.com/linuxqq/index.shtml")).text
r = r[r.find("x64DownloadUrl") :]
r = get2(r[: r.find("}")], "appimage")
name = "QQ.AppImage"
else:
exit(-1)
print("url:%s" % r)
# download
with open(name, "wb") as QQ:
for chunk in get(r, stream=True).iter_content(chunk_size=4096):
QQ.write(chunk)