mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2026-03-22 06:57:16 +08:00
更新代码
This commit is contained in:
21
main.py
21
main.py
@@ -43,22 +43,6 @@ def example():
|
|||||||
print(xhs.extract(video_demo, download=download))
|
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):
|
class XHSDownloader(App):
|
||||||
CSS_PATH = "static/XHS_Downloader.tcss"
|
CSS_PATH = "static/XHS_Downloader.tcss"
|
||||||
BINDINGS = [
|
BINDINGS = [
|
||||||
@@ -91,7 +75,9 @@ class XHSDownloader(App):
|
|||||||
|
|
||||||
def solo(self):
|
def solo(self):
|
||||||
url = self.query_one(Input).value
|
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):
|
def batch(self):
|
||||||
urls = self.Batch.read_txt()
|
urls = self.Batch.read_txt()
|
||||||
@@ -105,6 +91,5 @@ class XHSDownloader(App):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# example()
|
# example()
|
||||||
# program()
|
|
||||||
app = XHSDownloader()
|
app = XHSDownloader()
|
||||||
app.run()
|
app.run()
|
||||||
|
|||||||
Reference in New Issue
Block a user