文章参考
https://www.bilibili.com/read/cv20472358/
https://blog.csdn.net/weixin_43594279/article/details/107444501
https://zyy0911.github.io/2022/01/12/%E9%92%89%E9%92%89%E7%9B%B4%E6%92%AD%E5%9B%9E%E6%94%BE%E4%B8%8B%E8%BD%BD.html
https://github.com/Tencent/vConsole
代码参考
https://blog.csdn.net/Caiqiudan/article/details/109190522
https://wenku.csdn.net/answer/00a8bbd92b934f51a46f83da9dcd17eb
使用的js
https://cdn.bootcss.com/vConsole/3.14.0/vconsole.min.js
static function OnBeforeResponse(oSession: Session) {
if (m_Hide304s && oSession.responseCode == 304) {
oSession["ui-hide"] = "true";
}
var sToInsert = "<script src='https://cdn.bootcss.com/vConsole/3.14.0/vconsole.min.js'></script><script>var vConsole = new VConsole();</script>"
oSession.utilDecodeResponse();
oSession.utilReplaceOnceInResponse('</head>', sToInsert + '</head>', 0);
}
mm.m3u8 信息
9145a060-e7be-4457-b460-ecd9ec9d2c31/1.ts?auth_key=1695430249-0-0-8def38160d814974e4748d24f23d9029
9145a060-e7be-4457-b460-ecd9ec9d2c31/2.ts?auth_key=1695430249-0-0-5b4457330b144a9452b5d8005c387a3a
9145a060-e7be-4457-b460-ecd9ec9d2c31/3.ts?auth_key=1695430249-0-0-e734adc7cce7e0e1dad8d6fe062ca5ce
9145a060-e7be-4457-b460-ecd9ec9d2c31/4.ts?auth_key=1695430249-0-0-a8d02d9fb046d35f759df8154547e21e
9145a060-e7be-4457-b460-ecd9ec9d2c31/5.ts?auth_key=1695430249-0-0-29ce4961af88d5b2d324ba188b032e74
9145a060-e7be-4457-b460-ecd9ec9d2c31/6.ts?auth_key=1695430249-0-0-6542f8e9bd15b732ee4eb626b54cc274
9145a060-e7be-4457-b460-ecd9ec9d2c31/7.ts?auth_key=1695430249-0-0-cfbef11865f88c5a5e91e0c6f7706699
9145a060-e7be-4457-b460-ecd9ec9d2c31/8.ts?auth_key=1695430249-0-0-5f484c8e517b604eb8a6fb26f19f3f43
9145a060-e7be-4457-b460-ecd9ec9d2c31/9.ts?auth_key=1695430249-0-0-86905ee3c5baecbdc2128be0329d0270
python代码
import subprocess
import requests
import os
import re
my_list = []
patternnum = r'(\b\d{1,3}\.ts\b)'
video_file_path = os.getcwd() + r'\ddvideo'
if os.path.exists(video_file_path) == False:
os.mkdir(video_file_path)
with open("mm.m3u8", 'r') as f:
for line in f:
line = line.replace('\n', '')
match = re.search(patternnum, line)
if match:
url = f'https://dtliving-sz.dingtalk.com/live_hp/{line}'
r2 = requests.get(url, verify=False)
my_list.append(match.group(1))
with open(fr'.\ddvideo\{match.group(1)}', 'wb', ) as f:
f.write(r2.content)
print(url)
def concat_video():
print('合并视频中...')
output_file = 'output.mp4'
os.chdir('ddvideo')
ffmpeg_cmd = ['ffmpeg', '-y', '-i', 'concat:' + '|'.join(my_list), '-c', 'copy', output_file]
result = subprocess.run(ffmpeg_cmd, capture_output=True, text=True)
print(result.stdout)
print(result.stderr)
print('视频合并完成...')
if __name__ == '__main__':
concat_video()