From 4573ce1e72db5e5c15b2c474bb6ab14bed5a910f Mon Sep 17 00:00:00 2001 From: lvtomatoj Date: Thu, 25 Jan 2024 10:00:05 +0800 Subject: [PATCH] f --- pywxdump/api/api.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/pywxdump/api/api.py b/pywxdump/api/api.py index 3fa1886..4646d07 100644 --- a/pywxdump/api/api.py +++ b/pywxdump/api/api.py @@ -251,23 +251,11 @@ def get_img(): @api.route('/api/video/', methods=["GET", 'POST']) def get_video(videoPath): - savePath = os.path.join('video',videoPath) # 这个是从url中获取的 wx_path = read_session(g.sf, "wx_path") - video_path = os.path.join(wx_path, videoPath) - if os.path.exists(savePath): - return send_file(savePath) - if not videoPath: - return ReJson(1002) - # 判断savePath路径的文件夹是否存在 - savePath = os.path.join(g.tmp_path, savePath) - if not os.path.exists(os.path.dirname(savePath)): - os.makedirs(os.path.dirname(savePath)) - try: - shutil.copy(video_path, savePath) - except PermissionError: - if not os.path.exists(savePath): - return ReJson(5002) - return send_file(savePath) + all_video_path = os.path.join(wx_path, videoPath) + if not os.path.exists(all_video_path): + return ReJson(5002) + return send_file(all_video_path) @api.route('/api/audio/', methods=["GET", 'POST']) def get_audio(savePath):