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 55 56
| import requests
MAX_LEN = 3600 print("YJSchaf替你把视频全看了")
courseId = "。。"
c1 = "。。" c2 = "。。"
headers = { 'Host': 'data.educoder.net', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0', "Accept": "application/json", "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2", "Accept-Encoding": "gzip, deflate", "Referer": "https://www.educoder.net/classrooms/" + courseId + "/video", "Content-Type": "application/json; charset=utf-8", "Origin": "https://www.educoder.net", "Connection": "keep-alive", "Cookie": "autologin_trustie="+c1+";"+"_educoder_session="+c2 }
vedios_info_url = "https://data.educoder.net/api/courses/" + courseId + "/course_videos.json?coursesId=" + courseId + "&id=" + courseId + "&limit=100" vedios_info = requests.get(vedios_info_url, headers = headers).json()
post_url = "https://data.educoder.net/api/watch_video_histories.json"
for v in vedios_info["videos"]:
req_payload = { "point":0, "video_id": v["id"], "course_id": courseId , "duration": MAX_LEN, "device": "pc" }
response = requests.post(post_url, json = req_payload, headers = headers).json()
update_payload = { "point": MAX_LEN, "log_id": response["log_id"], "watch_duration": MAX_LEN, "total_duration": MAX_LEN, "ed":"1" } response = requests.post(post_url, json = update_payload, headers = headers).json()
if(response["message"] == "success"): print("【success】" + v["title"]) else: print("【fail】" + v["title"])
|