不是,连课都能卖?这是我没想到的~
import requests import re import time import os ''' 使用方法:https://www.jysafe.cn/4498.air ''' class FC(object): cookie = "" def __init__(self, cookie): self.cookie = cookie pass def fuckCourse(self, profiledId, courseId): try: body = { "optype": "true", "operator0": courseId + ":true:0", "lesson0":courseId, "schLessonGroup_" + courseId:"undefined" } req = requests.post("http://jwgl.cuit.edu.cn/eams/stdElectCourse!batchOperator.action?profileId=" + profiledId, headers={ "cookie": self.cookie, "X-Requested-With": "XMLHttpRequest", "Referer" : "http://jwgl.cuit.edu.cn/eams/stdElectCourse!batchOperator.action?profileId=" + profiledId, "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.0 Safari/537.36 Edg/84.0.521.0" }, data=body, timeout=5, allow_redirects=False) req.encoding = 'utf-8' html = req.text ret = re.search(r"margin:auto;\">\n\t\t\t\t(.*)<\/br>", html) if ret == None: print("cookie过期") exit(-1) pass print(ret.group(1)) if '成功' in ret.group(1): print('get') return True except Exception as err: print(err) return False pass pass if __name__ == "__main__": cookie = "semester.id=302; JSESSIONID=91C437F0A9006E9CD821FBCB0141949F; UM_distinctid=1763c6f7b491cd-05963b1e59c36-5a301348-100200-1763c6f7b4a52a; GSESSIONID=91C437F0A9006E9CD821FBCB0141949F" profiledId = "2213" courseId = "68558" if cookie == None: cookie = input("请输入cookie:") if profiledId == None: profiledId = input("请输入profiledId:") if courseId == None: courseId = input("请输入courseId:") print("开始了呀") cuit = FC(cookie) i= 0 while True: i += 1 print(i) if cuit.fuckCourse(profiledId, courseId): break time.sleep(0.5) if i >= 20: i = 0 os.system("cls") pass pass pass
profiledId可以直接看见