fix: path error
This commit is contained in:
parent
d7ff61304f
commit
ccb16fd24e
|
|
@ -375,19 +375,16 @@ class VodToLocalNode:
|
|||
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, save_path=output_dir, timeout=60 * 10)
|
||||
|
||||
def _download_file(self, url, save_path, timeout=30):
|
||||
def _download_file(self, url: str, save_path: str, timeout: int=30):
|
||||
"""下载文件到本地"""
|
||||
try:
|
||||
|
||||
with requests.get(url, stream=True, timeout=timeout) as response:
|
||||
response.raise_for_status()
|
||||
|
||||
with open(save_path, "wb") as f:
|
||||
for chunk in response.iter_content(chunk_size=8192):
|
||||
if chunk:
|
||||
f.write(chunk)
|
||||
|
||||
return str(save_path.resolve())
|
||||
return save_path
|
||||
except Exception as e:
|
||||
raise RuntimeError(f"Download error: {e}")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue