def get_page(self, course, task):
url = f'{self.host}/course/{course}/task/{task}/activity_show?blank=1'
html = self.sess.get(url, headers=self.headers).content.decode('utf-8')
fid = re.search('data-file-global-id="(.*?)"', html).group(1)
token = re.search('ata-token="(.*?)"', html).group(1)
url = f'https://play.qiqiuyun.net/sdk_api/play?resNo={fid}&token={token}&ssl=1&sdkType=js&lang=zh-CN&callback='
res = self.sess.get(url, headers=self.headers).json()
playlist_url = res['args']['playlist']
vname = res['args']['resource']['name'].strip('.mp4')
vname='Downloads/{}.mp4'.format(sx.检查文件名(vname))
res = self.sess.get(playlist_url).text
vurls = re.findall('(https://play.qiqiuyun.net/.*?)(\n|$)', res)
for k,v in self.清晰度.items():
for vurl in vurls:
vurl=vurl[0]
if v in vurl:
print(sx.scolor('正在下载:{}'.format(vname),'yes'),sx.scolor(k,'warn'))
return self.下载视频(p.文件路径, vurl)
return self.下载视频(p.文件路径, vurl)
#仅供学习参考