我们学校的超星要求学习次数
写了一个刷次数的程序
下面的代码大佬可以自己改改,写的不咋地
也有打包好的软件。
效果图:
https://zhangit.lanzous.com/ikOmWkc89ze
- import time, requests, re, json
- session = requests.session()
- headers = {'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 ChaoXingStudy/ChaoXingStudy_3_4.3.2_ios_phone_201911291130_27 (@Kalimdor)_11391565702936108810 '}
-
- def login(username, password):
- login_url = 'https://passport2-api.chaoxing.com/v11/loginregister'
- data = {'uname':username,
- 'code':password}
- res_login = session.post(login_url, data, headers)
- res_login = json.loads(res_login.content.decode('utf-8'))
- login_status = res_login['status']
- if login_status:
- print('success-登陆成功')
- return True
- print('false-登陆失败,检查账号密码')
- return False
-
-
- def get_course(zh, psw):
- if login(zh, psw):
- host_url = 'https://mooc1-1.chaoxing.com'
- course_url = 'https://mooc1-1.chaoxing.com/visit/courses'
- res_course = session.get(course_url, headers=headers)
- res_course = res_course.content.decode('utf-8')
- a = re.compile('target="_blank" title="(.*?)">')
- course_list = a.findall(res_course)
- b = re.compile('href=\\\'(.*?)\\\' target="_blank"')
- course_url = b.findall(res_course.replace('/mycourse/studentcourse', 'https://mooc1-1.chaoxing.com/mycourse/studentcourse'))
- print('正在获取当前账号课程信息·····')
- for i in range(len(course_list)):
- print('序号:%s 课程名:%s' % (i + 1, course_list[i]))
- else:
- return (
- course_list, course_url)
-
-
- def recome(url, set,cishu):
- print(f"【即将进行课程页面访问,时间间隔{str(set)}s.】")
- hosturl = 'https://mooc1-1.chaoxing.com'
- url = hosturl + str(url)
- print(f"目标课程网址{url}")
- for i in range(cishu):
- res = session.get(url=url, headers=headers)
-
- print(f"正在进行第{i + 1}次访问,准备下次访问中·····")
- time.sleep(set)
-
-
- if __name__ == '__main__':
- print(' Powered By IT萌主 ')
- print('-----------------------------------------------------------------------')
- try:
-
- print('-----------------------------------------------------------------------')
- phone = input('请输入手机号:')
- psw = input('请输入密码:')
- cname, curl = get_course(phone, psw)
- index = int(input('请输入要查询课程的前面 序号数字:'))
- timeset = int(input('请设置每次循环访问的时间(单位秒)数字 建议不低于40s:'))
- cishu=input('输入访问次数')
- recome(curl[(index - 1)], timeset,int(cishu))
- except:
- print('异常错误\n若还有问题 我也不知道咋办了')
- input('wait')
复制代码
|