perf: 优化清理空文件夹功能

This commit is contained in:
JoeanAmier 2024-11-02 21:42:29 +08:00
parent 856b4ece98
commit 7e0b0aca30
4 changed files with 6 additions and 4 deletions

View File

@ -161,7 +161,7 @@ def api_demo():
response = requests.post(server, json=data)
print(response.json())
</pre>
<h1>⚠️ 其他说明</h1>
<h1>📜 其他说明</h1>
<ul>
<li>由于作品链接携带日期信息,使用先前日期获取的作品链接可能会被风控,建议下载作品文件时使用最新获取的作品链接</li>
<li>Windows 系统需要以管理员身份运行程序才能读取 Chromium、Chrome、Edge 浏览器 Cookie</li>

View File

@ -165,7 +165,7 @@ def api_demo():
response = requests.post(server, json=data)
print(response.json())
</pre>
<h1>⚠️ Others</h1>
<h1>📜 Others</h1>
<ul>
<li>Due to the date information carried in the links of Xiaohongshu works, using links obtained from previous dates may be subject to risk control. It is recommended to use the latest Xiaohongshu works links when downloading Xiaohongshu work files</li>
<li>Windows system requires running programs as an administrator to read Chromium, Chrome, Edge browser cookies</li>

View File

@ -4,7 +4,7 @@ lxml>=5.3.0
PyYAML>=6.0.2
aiosqlite>=0.20.0
click>=8.1.7
rookiepy>=0.5.5
rookiepy>=0.5.6
httpx>=0.27.0
fastapi>=0.112.1
uvicorn>=0.30.6

View File

@ -1,3 +1,4 @@
from contextlib import suppress
from pathlib import Path
@ -18,4 +19,5 @@ def remove_empty_directories(path: Path) -> None:
if any(i in str(dir_path) for i in exclude):
continue
if not dir_names and not file_names:
dir_path.rmdir()
with suppress(OSError):
dir_path.rmdir()