From 93835134a5089fee9c00b0fb73e533df315df260 Mon Sep 17 00:00:00 2001 From: hatute Date: Mon, 8 May 2023 22:19:17 -0400 Subject: [PATCH] add a feature for multi-user downloading --- TikTokTool.py | 13 +++++++------ Util/Command.py | 4 +++- conf.ini | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/TikTokTool.py b/TikTokTool.py index b45abbb..d774ad6 100644 --- a/TikTokTool.py +++ b/TikTokTool.py @@ -24,11 +24,12 @@ def __init__(self): if __name__ == '__main__': # 获取命令行参数 cmd = Util.Command() - # 获取headers - headers = Util.Cookies(cmd.setting()).dyheaders - # 获取主页内容 - profile = Util.Profile(headers) - # 使用参数并下载 - profile.getProfile(cmd.setting()) + for user in cmd.setting(): + # 获取headers + headers = Util.Cookies(user).dyheaders + # 获取主页内容 + profile = Util.Profile(headers) + # 使用参数并下载 + profile.getProfile(user) input('[ 完成 ]:已完成批量下载,输入任意键后退出:') diff --git a/Util/Command.py b/Util/Command.py index 50a2530..e2242d5 100644 --- a/Util/Command.py +++ b/Util/Command.py @@ -79,7 +79,9 @@ def setting(self): self.update = args.update print('[ 提示 ]:读取命令完成!\r') Util.log.info('[ 提示 ]:读取命令完成!') - return [self.uid, self.music, self.mode, self.cookie, self.interval, self.update] + import ast + self.uid_list = ast.literal_eval(self.uid) + return [[f"[\"{uid}\"]", self.music, self.mode, self.cookie, self.interval, self.update] for uid in self.uid_list] if __name__ == '__main__': diff --git a/conf.ini b/conf.ini index da3c378..272a363 100644 --- a/conf.ini +++ b/conf.ini @@ -1,7 +1,7 @@ [uid] # 用户主页(非视频链接) # 单视频请用TikTokDownload或TikTokWeb -uid = https://www.douyin.com/user/MS4wLjABAAAA3nckmLU8MKXB4Aao7ZOOLaHIRCJG5AzKMDRh_6WMkU4 +uid = ["https://www.douyin.com/user/MS4wLjABAAAA3nckmLU8MKXB4Aao7ZOOLaHIRCJG5AzKMDRh_6WMkU4","https://www.douyin.com/user/MS4wLjABAAAA3nckmLU8MKXB4Aao7ZOOLaHIRCJG5AzKMDRh_6WMkU4"] [music] # 视频原声保存(yes|no) @@ -30,4 +30,4 @@ interval = 0 [update] # 选择是否自动更新(yes|no) # 由于抖音频繁更新推荐开启此项 -update = yes \ No newline at end of file +update = yes