From e3e22862e757c6502ec63e3f50fdafaa223edcd5 Mon Sep 17 00:00:00 2001 From: Evil0ctal Date: Thu, 10 Feb 2022 20:29:21 -0800 Subject: [PATCH] =?UTF-8?q?=20=F0=9F=90=B1=E6=B7=BB=E5=8A=A0=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E5=90=8E=E5=AF=B9=E8=BE=93=E5=85=A5=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E7=9A=84=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TikTok_ZH.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/TikTok_ZH.py b/TikTok_ZH.py index 25ce6fb..4137f44 100644 --- a/TikTok_ZH.py +++ b/TikTok_ZH.py @@ -2,7 +2,7 @@ # -*- encoding: utf-8 -*- # @Author: https://github.com/Evil0ctal/ # @Time: 2021/11/06 -# @Update: 2022/02/06 +# @Update: 2022/02/10 # @Function: # 基于 PyWebIO、Requests、Flask,可实现在线批量解析抖音的无水印视频/图集。 # 可用于下载作者禁止下载的视频,同时可搭配iOS的快捷指令APP配合本项目API实现应用内下载。 @@ -69,7 +69,7 @@ def clean_filename(string, author_name): return filename -def error_do(e, func_name): +def error_do(e, func_name, input_value=''): # 输出一个毫无用处的信息 put_html("
") put_error("出现了意料之的错误,请检查输入值是否有效!") @@ -84,10 +84,10 @@ def error_do(e, func_name): # 将错误记录在logs.txt中 date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) with open('logs.txt', 'a') as f: - f.write(date + " " + func_name + ': ' + str(e) + '\n') + f.write(date + ":\n" + func_name + ': ' + str(e) + '\n' + "Input value: " + input_value + '\n') -def loading(url_lists): +def loading(): # 写一个进度条装装样子吧 :) set_scope('bar', position=3) with use_scope('bar'): @@ -110,7 +110,7 @@ def get_tiktok_url(tiktok_link): true_link = response.headers['Location'].split("?")[0] return true_link except Exception as e: - error_do(e, get_tiktok_url) + error_do(e, get_tiktok_url, tiktok_link) @retry(stop_max_attempt_number=3) @@ -182,7 +182,7 @@ def get_video_info(original_url): return video_info, 'video', api_url except Exception as e: # 异常捕获 - error_do(e, 'get_video_info') + error_do(e, 'get_video_info', original_url) @retry(stop_max_attempt_number=3) @@ -210,7 +210,7 @@ def get_video_info_tiktok(tiktok_url): return video_info except Exception as e: # 异常捕获 - error_do(e, 'get_video_info_tiktok') + error_do(e, 'get_video_info_tiktok', tiktok_url) @retry(stop_max_attempt_number=3) @@ -233,7 +233,7 @@ def tiktok_nwm(tiktok_url): true_link = r.headers['Location'] return true_link except Exception as e: - error_do(e, "tiktok_nwm") + error_do(e, "tiktok_nwm", tiktok_url) @app.route("/api")