-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
54 lines (47 loc) · 1.38 KB
/
main.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
import logging
import threading
import time
import queryer
import grabber
class miHomo:
def __init__(self):
self.queryer = queryer.Queryer()
self.grabber = grabber.Grabber()
def new(self):
return self
def main():
print("\033[31m[Tip] Please check again the cookie, \
search_ls and connection to the host. \
Because of the multi-threading, \
the program cannot be stopped unless forcefully terminated.\033[0m")
logging.basicConfig(level=logging.INFO)
tool = miHomo()
queryer = tool.queryer
# query for loop
while True:
queryer.all_renwen(cookie)
if queryer.ls.__len__() == 0:
logging.error("No courses found")
time.sleep(0.5)
continue
queryer.all_ziran(cookie)
break
queryer.ls2ld(search_ls)
loads = queryer.ld
logging.info("Courses found")
print(loads)
# grab normally
def th(lds):
tool.grabber.loop_rob(cookie, lds)
for i in range(loads.__len__()):
threading.Thread(target=th, args=(loads[i],)).start()
if __name__ == "__main__":
# Please enter your cookie here
cookie = "PHPSESSID=ST-911652-ithrpm06JjhZEQN5hIQ6Vo-Uyzgauthserver2"
search_ls = [
"宇宙的奥秘",
"中国民间剪纸艺术",
"职场心理学",
"高等数学"
]
main()