Skip to content

Commit

Permalink
更新代码
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeanAmier committed Sep 26, 2023
1 parent d99fef1 commit 3197fee
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -91,7 +75,9 @@ def on_button_pressed(self, event: Button.Pressed) -> None:

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()
Expand All @@ -105,6 +91,5 @@ def batch(self):

if __name__ == '__main__':
# example()
# program()
app = XHSDownloader()
app.run()

0 comments on commit 3197fee

Please sign in to comment.