# author: ya0guang import requests import time # fill in this pls! sessionID = "你的sessionid" # 这里填写课程的classid courseID = 1252 ccID = 753 classID = 56 watchTime = 120 #courseList: (courseID, ccID) 这里填写每个视频的courseid和ccid courseList = {(1263, 758), (1270, 760), (1279,762), (1280, 763), (1281, 764), (1282, 765), (1283, 766)} postData = {"courseID": courseID, "watchTime": watchTime, "ccID": ccID, "classID": classID} headers = {"Host": "xjtudj.edu.cn", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36", "Accept": "application/json, text/javascript, */*; q=0.01", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,zh-TW;q=0.8,en;q=0.7"} cookie = {'route': '', "JSESSIONID": sessionID} url = "http://xjtudj.edu.cn/course/course_updateUserWatchRecord.do" for course in courseList: (courseID, ccID) = course print(course) for watchTime in range(0, 12000, 60): # 对于一些时间长的课程,这里设置合适的时间(此处为12000秒) postData = {"courseID": courseID, "watchTime": watchTime, "ccID": ccID, "classID": classID} r = requests.post(url,data=postData, cookies=cookie, headers=headers) time.sleep(0.1) print(course, r.text)