fix
This commit is contained in:
parent
919a40893e
commit
d7ff61304f
|
|
@ -373,15 +373,11 @@ class VodToLocalNode:
|
|||
# 生成一个临时目录路径名并创建该目录
|
||||
self.create_directory(os.path.join(os.path.dirname(os.path.abspath(__file__)), "download", f"{sub_app_id}"))
|
||||
output_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "download", f"{sub_app_id}", f"{file_id}.mp4" )
|
||||
return self._download_file(url=media_url, output_dir=output_dir, file_id=file_id, timeout=60 * 10)
|
||||
return self._download_file(url=media_url, save_path=output_dir, timeout=60 * 10)
|
||||
|
||||
def _download_file(self, url, output_dir, file_id, timeout=30):
|
||||
def _download_file(self, url, save_path, timeout=30):
|
||||
"""下载文件到本地"""
|
||||
try:
|
||||
# 生成安全文件名
|
||||
file_extension = os.path.splitext(url)[1] or ".mp4"
|
||||
filename = f"{file_id}{file_extension}"
|
||||
save_path = Path(output_dir) / filename
|
||||
|
||||
with requests.get(url, stream=True, timeout=timeout) as response:
|
||||
response.raise_for_status()
|
||||
|
|
|
|||
Loading…
Reference in New Issue