This repository was archived by the owner on Jun 3, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 1919from my_xxt .answer_type import AnswerType
2020from my_xxt .question_type import QuestionType
2121
22-
2322# 加密密钥
2423key = b"u2oh6Vu^HWe4_AES"
2524
3837# 确认提交(get)
3938IS_COMMIT = "https://mooc1.chaoxing.com/work/validate"
4039
40+ # 获取个人信息(get)
41+ SELF_INFO = "http://passport2.chaoxing.com/mooc/accountManage"
42+
4143# 答案题目类型
4244answer_type = [
4345 {"type" : "单选题" , "fun" : "multipleChoice" , "key" : "0" },
@@ -144,6 +146,21 @@ def getCourse(self) -> list:
144146 i = i + 1
145147 return course_list
146148
149+ def getInfo (self ) -> dict :
150+ info_html = self .sees .get (
151+ url = SELF_INFO ,
152+ headers = {
153+ "User-Agent" : self .header ,
154+ },
155+ )
156+ info_html_soup = BeautifulSoup (info_html .text , "lxml" )
157+ info_html_soup = info_html_soup .find ("div" , attrs = {"class" : "infoDiv" })
158+ info = {
159+ "name" : info_html_soup .find ("span" , attrs = {"id" : "messageName" })["value" ],
160+ "student_number" : info_html_soup .find ("p" , attrs = {"class" : "xuehao" }).text .replace ("学号/工号:" , "" )
161+ }
162+ return info
163+
147164 def getWorks (self , course_url : str , course_name : str ) -> list :
148165 """
149166 获取一个课程的作业
Original file line number Diff line number Diff line change @@ -19,5 +19,6 @@ def login(console: Console, xxt: XcxyXxt) -> None:
1919 if flag == 'q' :
2020 exit ()
2121 else :
22- console .print ("[green]登录成功" )
22+ info = xxt .getInfo ()
23+ console .print (f"[green]登录成功,{ info ['name' ]} " )
2324 break
You can’t perform that action at this time.
0 commit comments