From 9982a7bf3ab8deec2279b92b5a86a11fb357a0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=ADhuajijam?= Date: Sat, 23 Apr 2022 11:08:24 +0800 Subject: [PATCH] add _t --- api/chaoxing.py | 13 +++++++++---- main.py | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/api/chaoxing.py b/api/chaoxing.py index a1a1773..37bf9a9 100644 --- a/api/chaoxing.py +++ b/api/chaoxing.py @@ -68,6 +68,9 @@ def status(self): else: return False + def get_current_ms(): + return round(time.time() * 1000) + def get_all_courses(self): url = 'https://mooc1-api.chaoxing.com/mycourse/backclazzdata?view=json&mcode=' courses = self.session.get(url).json() @@ -169,7 +172,7 @@ def add_log(self, personid, courseid, classid, encode): self.logger.debug(resp.text) self.logger.debug("---resp.text info end---") - def main_pass_video(self, personid, dtoken, otherInfo, playingTime, clazzId, duration, jobid, objectId, userid): + def main_pass_video(self, personid, dtoken, otherInfo, playingTime, clazzId, duration, jobid, objectId, userid, time): url = 'https://mooc1-api.chaoxing.com/multimedia/log/a/{}/{}'.format(personid, dtoken) # print(url) params = { @@ -186,12 +189,13 @@ def main_pass_video(self, personid, dtoken, otherInfo, playingTime, clazzId, dur 'enc': self.get_enc(clazzId, jobid, objectId, playingTime, duration, userid), 'rt': '0.9', # 'rt': '1.0', ?? 'dtype': 'Video', - 'view': 'json' + 'view': 'json', + '_t': time } # print:(url+params) return self.session.get(url, params=params).json() - def pass_video(self, video_duration, cpi, dtoken, otherInfo, clazzid, jobid, objectid, userid, name, speed): + def pass_video(self, video_duration, cpi, dtoken, otherInfo, clazzid, jobid, objectid, userid, name, speed, time): sec = 58 playingTime = 0 print("当前播放速率:"+str(speed)+"倍速") @@ -207,7 +211,8 @@ def pass_video(self, video_duration, cpi, dtoken, otherInfo, clazzid, jobid, obj video_duration, jobid, objectid, - userid + userid, + time ) # print(res) if res.get('isPassed'): diff --git a/main.py b/main.py index d985f42..ae459f5 100644 --- a/main.py +++ b/main.py @@ -86,7 +86,8 @@ def do_work(chaoxingAPI): video_info['objectid'], chaoxingAPI.uid, attachment['property']['name'], - chaoxingAPI.speed + chaoxingAPI.speed, + chaoxingAPI.get_current_ms ) ft.pause(1, 3) chaoxing.speed = set_speed # 预防ERR