mzltest commited on
Commit
c47b5e0
1 Parent(s): 89b7476

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -60,8 +60,13 @@ def dlvid(vid):
60
  os.remove("test.mp4")
61
 
62
  # 使用 ffmpeg 将 m3u8 转换为 mp4
63
- mp3link = hlsuri # 假设你的 m3u8 地址存储在 mp3link 中
64
- ffmpeg_command = f'ffmpeg -protocol_whitelist "concat,file,http,https,tcp,tls,crypto" -i "{mp3link}" -c copy -cookies "{s.cookies.get_dict()}" "test.mp4"'
 
 
 
 
 
65
  os.system(ffmpeg_command)
66
  return 'test.mp4'
67
  else:
 
60
  os.remove("test.mp4")
61
 
62
  # 使用 ffmpeg 将 m3u8 转换为 mp4
63
+ cookie_dict = s.cookies.get_dict()
64
+ cookie_string = ''
65
+ for key, value in cookie_dict.items():
66
+ cookie_string += f'{key}={value}; path=/; domain={response.url.split("//")[1].split("/")[0]}; '
67
+
68
+ ffmpeg_command = f'ffmpeg -protocol_whitelist "concat,file,http,https,tcp,tls,crypto" -i "{mp3link}" -c copy -cookies "{cookie_string}" "test.mp4"'
69
+
70
  os.system(ffmpeg_command)
71
  return 'test.mp4'
72
  else: