Skip to content

Commit

Permalink
feat: 发布 2.4 版本
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeanAmier committed Jan 5, 2025
1 parent b3974fe commit bd7af3d
Show file tree
Hide file tree
Showing 19 changed files with 25 additions and 29 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
<p>⭐ XHS-Downloader 开发计划及进度可前往 <a href="https://github.com/users/JoeanAmier/projects/5">Projects</a> 查阅</p>
<h1>📸 程序截图</h1>
<p><b>🎥 点击图片观看演示视频</b></p>
<a href="https://www.bilibili.com/video/BV1KGWNeCEyM/"><img src="static/screenshot/程序运行截图CN1.png" alt=""></a>
<a href="https://www.bilibili.com/video/BV1c56BYJEFm/"><img src="static/screenshot/程序运行截图CN1.png" alt=""></a>
<hr>
<a href="https://www.bilibili.com/video/BV1KGWNeCEyM/"><img src="static/screenshot/程序运行截图CN2.png" alt=""></a>
<a href="https://www.bilibili.com/video/BV1c56BYJEFm/"><img src="static/screenshot/程序运行截图CN2.png" alt=""></a>
<hr>
<a href="https://www.bilibili.com/video/BV1KGWNeCEyM/"><img src="static/screenshot/程序运行截图CN3.png" alt=""></a>
<a href="https://www.bilibili.com/video/BV1c56BYJEFm/"><img src="static/screenshot/程序运行截图CN3.png" alt=""></a>
<h1>🔗 支持链接</h1>
<ul>
<li><code>https://www.xiaohongshu.com/explore/作品ID?xsec_token=XXX</code></li>
Expand Down Expand Up @@ -106,9 +106,9 @@
<p>命令示例:<code>python .\main.py --browser_cookie Chrome --update_settings</code></p>
<p><code>bool</code> 类型参数支持使用 <code>true</code>、<code>false</code>、<code>1</code>、<code>0</code>、<code>yes</code>、<code>no</code>、<code>on</code> 或 <code>off</code>(不区分大小写)来设置。</p>
<hr>
<img src="static/screenshot/命令行模式截图1.png" alt="">
<img src="static/screenshot/命令行模式截图CN1.png" alt="">
<hr>
<img src="static/screenshot/命令行模式截图2.png" alt="">
<img src="static/screenshot/命令行模式截图CN2.png" alt="">
<h1>🖥 服务器模式</h1>
<p><b>启动:</b>运行命令:<code>python .\main.py server</code></p>
<p><b>关闭:</b>按下 <code>Ctrl</code> + <code>C</code> 关闭服务器</p>
Expand Down Expand Up @@ -197,6 +197,7 @@ def api_demo():
<li>提取发现作品链接、搜索作品、用户链接时,脚本可以自动滚动页面加载更多内容,默认滚动页面次数:10 次</li>
<li>自动滚动页面功能默认关闭;用户可以自由开启,并修改滚动检测间隔、滚动页面次数,修改后立即生效</li>
<li>如果未开启自动滚动页面功能,用户需要手动滚动页面以便加载更多内容后再进行其他操作</li>
<li>支持作品文件打包下载;该功能默认开启,多个文件的作品将会以压缩包格式下载</li>
<li>使用全局代理工具可能会导致脚本下载文件失败,如有异常,请尝试关闭代理工具,必要时向作者反馈</li>
<li>XHS-Downloader 用户脚本仅实现可见即可得的数据采集功能,无任何收费功能和破解功能</li>
</ul>
Expand Down
13 changes: 7 additions & 6 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
<p>⭐ The development plan and progress of XHS-Downloader can be found at <a href="https://github.com/users/JoeanAmier/projects/5">Projects</a></p>
<h1>📸 Program Screenshots</h1>
<p><b>🎥 Click the images to watch the demo video</b></p>
<a href="https://www.bilibili.com/video/BV1KGWNeCEyM/"><img src="static/screenshot/程序运行截图EN1.png" alt=""></a>
<a href="https://www.bilibili.com/video/BV1c56BYJEFm/"><img src="static/screenshot/程序运行截图EN1.png" alt=""></a>
<hr>
<a href="https://www.bilibili.com/video/BV1KGWNeCEyM/"><img src="static/screenshot/程序运行截图EN2.png" alt=""></a>
<a href="https://www.bilibili.com/video/BV1c56BYJEFm/"><img src="static/screenshot/程序运行截图EN2.png" alt=""></a>
<hr>
<a href="https://www.bilibili.com/video/BV1KGWNeCEyM/"><img src="static/screenshot/程序运行截图EN3.png" alt=""></a>
<a href="https://www.bilibili.com/video/BV1c56BYJEFm/"><img src="static/screenshot/程序运行截图EN3.png" alt=""></a>
<h1>🔗 Supported Links</h1>
<ul>
<li><code>https://www.xiaohongshu.com/explore/WorksID?xsec_token=XXX</code></li>
Expand Down Expand Up @@ -107,9 +107,9 @@
<p>Command example: <code>python .\main.py --browser_cookie Chrome --update_settings</code></p>
<p>The <code>bool</code> type parameters support setting with <code>true</code>, <code>false</code>, <code>1</code>, <code>0</code>, <code>yes</code>, <code>no</code>, <code>on</code> or <code>off</code> (case insensitive).</p>
<hr>
<img src="static/screenshot/命令行模式截图1.png" alt="">
<img src="static/screenshot/命令行模式截图EN1.png" alt="">
<hr>
<img src="static/screenshot/命令行模式截图2.png" alt="">
<img src="static/screenshot/命令行模式截图EN2.png" alt="">
<h1>🖥 Server Mode</h1>
<p><b>Start:</b> Run the command: <code>python .\main.py server</code></p>
<p><b>Stop:</b> Press <code>Ctrl</code> + <code>C</code> to stop the server</p>
Expand Down Expand Up @@ -201,6 +201,7 @@ def api_demo():
<li>When extracting links to explore works, searching for works, and user links, the script can automatically scroll the page to load more content. The default number of page scrolls is 10.</li>
<li>The automatic page scroll feature is turned off by default. Users can enable it and modify the scroll detection interval and the number of scrolls, with changes taking effect immediately.</li>
<li>If the automatic page scroll feature is not enabled, users need to manually scroll the page to load more content before performing other actions.</li>
<li>Support packaging and downloading of work files; This feature is enabled by default, and works from multiple files will be downloaded in compressed file format</li>
<li>Using global proxy tools may cause script download failures. If there are issues, please try disabling the proxy tool. If necessary, contact the author for feedback.</li>
<li>XHS-Downloader userscript only implements the data collection functionality for visible content and does not include any paid or cracked features.</li>
</ul>
Expand Down Expand Up @@ -285,7 +286,7 @@ async def example():
<tr>
<td align="center">name_format</td>
<td align="center">str</td>
<td align="center"><sup><a href="#fields">1</a></sup>Format of works file name, separated by spaces between fields, supports fields: <code>收藏数量</code>、<code>评论数量</code>、<code>分享数量</code>、<code>点赞数量</code>、<code>作品标签</code>、<code>作品ID</code>、<code>作品标题</code>、<code>作品描述</code>、<code>作品类型</code>、<code>发布时间</code>、<code>最后更新时间</code>、<code>作者昵称</code>、<code>作者ID</code></td>
<td align="center"><sup><a href="#fields">#</a></sup>Format of works file name, separated by spaces between fields, supports fields: <code>收藏数量</code>、<code>评论数量</code>、<code>分享数量</code>、<code>点赞数量</code>、<code>作品标签</code>、<code>作品ID</code>、<code>作品标题</code>、<code>作品描述</code>、<code>作品类型</code>、<code>发布时间</code>、<code>最后更新时间</code>、<code>作者昵称</code>、<code>作者ID</code></td>
<td align="center"><code>发布时间 作者昵称 作品标题</code></td>
</tr>
<tr>
Expand Down
21 changes: 10 additions & 11 deletions source/CLI/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ def inner(ctx: Context, param, value):

class CLI:
def __init__(self, ctx: Context, **kwargs):
# print(kwargs)
self.ctx = ctx
self.url = kwargs.pop("url")
self.index = self.__format_index(kwargs.pop("index"))
self.path = kwargs.pop("settings")
self.update = kwargs.pop("update_settings")
# print(kwargs)
self.url = ctx.params.pop("url")
self.index = self.__format_index(ctx.params.pop("index"))
self.path = ctx.params.pop("settings")
self.update = ctx.params.pop("update_settings")
self.settings = Settings(self.__check_settings_path())
self.parameter = self.settings.run() | self.__clean_params(kwargs)
self.parameter = self.settings.run() | self.__clean_params(ctx.params)
self.APP = XHS(**self.parameter)

async def __aenter__(self):
Expand Down Expand Up @@ -116,7 +114,8 @@ def help_(ctx: Context, param, value) -> None:

options = (
("--url", "-u", "str", _("小红书作品链接")),
("--index", "-i", "str", _("下载指定序号的图片文件,仅对图文作品生效;多个序号输入示例:\"1 3 5 7\"")),
("--index", "-i", "str",
fill(_("下载指定序号的图片文件,仅对图文作品生效;多个序号输入示例:\"1 3 5 7\""), width=55),),
("--work_path", "-wp", "str", _("作品数据 / 文件保存根路径")),
("--folder_name", "-fn", "str", _("作品文件储存文件夹名称")),
("--name_format", "-nf", "str", _("作品文件名称格式")),
Expand All @@ -126,7 +125,7 @@ def help_(ctx: Context, param, value) -> None:
("--cookie", "-ck", "str", _("小红书网页版 Cookie,无需登录")),
("--proxy", "-p", "str", _("网络代理")),
("--timeout", "-t", "int", _("请求数据超时限制,单位:秒")),
("--chunk", "-c", "int", _("下载文件时,每次从服务器获取的数据块大小,单位:字节")),
("--chunk", "-c", "int", fill(_("下载文件时,每次从服务器获取的数据块大小,单位:字节"), width=55),),
("--max_retry", "-mr", "int", _("请求数据失败时,重试的最大次数")),
("--record_data", "-rd", "bool", _("是否记录作品数据至文件")),
("--image_format", "-if", "choice", _("图文作品文件下载格式,支持:PNG、WEBP")),
Expand All @@ -141,7 +140,7 @@ def help_(ctx: Context, param, value) -> None:
BrowserCookie.SUPPORT_BROWSER.keys(),
start=1,
))
), width=40)),
), width=55)),
("--update_settings", "-us", "flag", _("是否更新配置文件")),
("--help", "-h", "flag", _("查看详细参数说明")),
("--version", "-v", "flag", _("查看 XHS-Downloader 版本")),
Expand Down Expand Up @@ -218,4 +217,4 @@ async def main():
from click.testing import CliRunner

runner = CliRunner()
result = runner.invoke(cli, ['-l', 'en_US', '-h'])
result = runner.invoke(cli, ['-l', 'en_US', '-u', ''])
4 changes: 0 additions & 4 deletions source/TUI/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def on_mount(self) -> None:
">" *
50}",
style=MASTER),
animate=True,
scroll_end=True,
)
self.xhs.manager.print_proxy_tip(log=self.tip, )
Expand All @@ -102,12 +101,10 @@ async def deal_button(self):
else:
self.tip.write(
Text(_("未输入任何小红书作品链接"), style=WARNING),
animate=True,
scroll_end=True,
)
self.tip.write(
Text(">" * 50, style=GENERAL),
animate=True,
scroll_end=True,
)

Expand All @@ -132,7 +129,6 @@ async def deal(self):
)
self.tip.write(
Text(">" * 50, style=GENERAL),
animate=True,
scroll_end=True,
)
await self.app.action_back()
Expand Down
1 change: 0 additions & 1 deletion source/TUI/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def on_mount(self) -> None:
Text(_(
"程序会自动读取并提取剪贴板中的小红书作品链接,并自动下载链接对应的作品文件,如需关闭,请点击关闭按钮,或者向剪贴板写入 “close” 文本!"),
style=MASTER),
animate=True,
scroll_end=True,
)
self.run_monitor()
Expand Down
2 changes: 1 addition & 1 deletion source/module/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

VERSION_MAJOR = 2
VERSION_MINOR = 4
VERSION_BETA = True
VERSION_BETA = False
ROOT = Path(__file__).resolve().parent.parent.parent
PROJECT = f"XHS-Downloader V{VERSION_MAJOR}.{
VERSION_MINOR}{" Beta" if VERSION_BETA else ""}"
Expand Down
2 changes: 1 addition & 1 deletion source/module/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async def inner(self, *args, **kwargs):
def logging(log, text, style=INFO):
string = Text(text, style=style)
if log:
log.write(string, animate=True, scroll_end=True, )
log.write(string, scroll_end=True, )
else:
print(string)

Expand Down
Binary file removed static/screenshot/命令行模式截图1.png
Binary file not shown.
Binary file removed static/screenshot/命令行模式截图2.png
Binary file not shown.
Binary file added static/screenshot/命令行模式截图CN1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/screenshot/命令行模式截图CN2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/screenshot/命令行模式截图EN1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/screenshot/命令行模式截图EN2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/screenshot/程序运行截图CN1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/screenshot/程序运行截图CN2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/screenshot/程序运行截图CN3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/screenshot/程序运行截图EN1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/screenshot/程序运行截图EN2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/screenshot/程序运行截图EN3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bd7af3d

Please sign in to comment.