Skip to content

Commit

Permalink
add _t
Browse files Browse the repository at this point in the history
  • Loading branch information
huajijam committed Apr 23, 2022
1 parent f2cddc9 commit 9982a7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions api/chaoxing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 = {
Expand All @@ -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)+"倍速")
Expand All @@ -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'):
Expand Down
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9982a7b

Please sign in to comment.