From 99c62922ca701de2e7eccb68b3c3e67b98d9fcef Mon Sep 17 00:00:00 2001 From: imgyh <1974355683@qq.com> Date: Wed, 29 Mar 2023 18:59:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(tiktok):=20=E7=BC=A9=E7=9F=AD=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=8D=E9=95=BF=E5=BA=A6,=E5=8F=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=95=B0=E5=AD=97=E5=AD=97=E6=AF=8D=E6=B1=89=E5=AD=97?= =?UTF-8?q?=E4=BD=9C=E4=B8=BA=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #19 --- TikTok.py | 6 +++--- TikTokUtils.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TikTok.py b/TikTok.py index 6c8a08d..7819c69 100644 --- a/TikTok.py +++ b/TikTok.py @@ -169,7 +169,7 @@ class TikTok(object): if end - start > self.timeout: # raise RuntimeError("重复请求该接口" + str(self.timeout) + "s, 仍然未获取到数据") print("[ 提示 ]:重复请求该接口" + str(self.timeout) + "s, 仍然未获取到数据") - return {} + return {},{} # print("[ 警告 ]:接口未返回数据, 正在重新请求!\r") # 清空self.awemeDict @@ -617,7 +617,7 @@ class TikTok(object): try: # 使用作品 创建时间+描述 当文件夹 - file_name = awemeDict["create_time"] + " " + self.utils.replaceStr(awemeDict["desc"]) + file_name = awemeDict["create_time"] + "_" + self.utils.replaceStr(awemeDict["desc"]) aweme_path = os.path.join(savePath, file_name) if not os.path.exists(aweme_path): os.mkdir(aweme_path) @@ -723,10 +723,10 @@ class TikTok(object): # print("[ 提示 ]:avatar 已存在为您跳过...\r\n") pass else: - self.isdwownload = False try: url = awemeDict["author"]["avatar"]["url_list"][0] if url != "": + self.isdwownload = False # task_id = self.progress.add_task("download", filename="[ 头像 ]:" + desc, start=False) # self.alltask.append(self.pool.submit(self.copy_url, task_id, url, avatar_path)) self.alltask.append( diff --git a/TikTokUtils.py b/TikTokUtils.py index 48b3c7d..91ed986 100644 --- a/TikTokUtils.py +++ b/TikTokUtils.py @@ -42,7 +42,7 @@ class Utils(object): 替换非法字符,缩短字符长度,使其能成为文件名 """ # 匹配 汉字 字母 数字 空格 - match = "([0-9A-Za-z\u4e00-\u9fa5 #_-]+)" + match = "([0-9A-Za-z\u4e00-\u9fa5]+)" result = re.findall(match, filenamestr)