From 3197feec575cd3e19aea03f4f8e06007c2ed7993 Mon Sep 17 00:00:00 2001 From: JoeamAmier Date: Tue, 26 Sep 2023 21:56:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/main.py b/main.py index 3ee9c73..9fb040e 100644 --- a/main.py +++ b/main.py @@ -43,22 +43,6 @@ def example(): print(xhs.extract(video_demo, download=download)) -def program(): - """读取并应用配置文件设置的参数,适合一般作品文件下载需求""" - print("如果采集数据失败,请尝试使用手动获取的 Cookie 运行程序!") - xhs = XHS(**Settings().run()) - if ids := Batch().read_txt(): - for i in ids: - print(f"当前作品链接: {i}") - xhs.extract(i, download=True) - else: - while True: - if url := input("请输入小红书作品链接:"): - xhs.extract(url, download=True) - else: - break - - class XHSDownloader(App): CSS_PATH = "static/XHS_Downloader.tcss" BINDINGS = [ @@ -91,7 +75,9 @@ class XHSDownloader(App): def solo(self): url = self.query_one(Input).value - self.APP.extract(url, True, self.query_one(Log)) + log = self.query_one(Log) + log.write_line(f"当前作品链接: {url}") + self.APP.extract(url, True, log) def batch(self): urls = self.Batch.read_txt() @@ -105,6 +91,5 @@ class XHSDownloader(App): if __name__ == '__main__': # example() - # program() app = XHSDownloader() app.run()