diff --git a/__init__.py b/__init__.py index 78b5e16..2e2e206 100644 --- a/__init__.py +++ b/__init__.py @@ -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()