diff --git a/README.md b/README.md index 104047a..fa35d4c 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@

🛠 命令行模式

项目支持命令行运行模式,若想要下载图文作品的部分图片,可以使用此模式设置需要下载的图片序号!

+

注意:未设置 --index 参数时,支持传入多个作品链接,全部链接需要使用引号包围,链接之间使用空格分隔;已设置 --index 参数时,不支持传入多个作品链接,即使传入多个作品链接,程序仅处理首个作品链接!

可以使用命令行 从浏览器读取 Cookie 并写入配置文件!

命令示例:python .\main.py --browser_cookie Chrome --update_settings

bool 类型参数支持使用 truefalse10yesnoonoff(不区分大小写)来设置。

diff --git a/README_EN.md b/README_EN.md index 5280e4b..38d6463 100644 --- a/README_EN.md +++ b/README_EN.md @@ -117,7 +117,8 @@
  • Run main.py to use
  • 🛠 Command Line Mode

    -

    The project supports command line mode. If you want to download specific images from a text and image work, you can use this mode to set the image sequence number you want to download!

    +

    The project supports command line mode. If you want to download specific images from a text and image works, you can use this mode to set the image sequence number you want to download!

    +

    Note: When the --index parameter is not set, multiple works links can be passed in. All links must be enclosed in quotation marks and separated by spaces. When the --index parameter is set, multiple works links are not supported. Even if multiple links are passed in, the program will only process the first link!

    You can use the command line to read cookies from the browser and write to the configuration file!

    Command example: python .\main.py --browser_cookie Chrome --update_settings

    The bool type parameters support setting with true, false, 1, 0, yes, no, on or off (case insensitive).

    diff --git a/source/CLI/main.py b/source/CLI/main.py index 81784d3..9c5a47e 100644 --- a/source/CLI/main.py +++ b/source/CLI/main.py @@ -121,19 +121,19 @@ class CLI: ) options = ( - ("--url", "-u", "str", _("小红书作品链接")), + ("--url", "-u", "str", _("小红书作品链接,多个链接使用空格分隔")), ( "--index", "-i", "str", fill( _( - '下载指定序号的图片文件,仅对图文作品生效;多个序号输入示例:"1 3 5 7"' + '下载指定序号的图片文件,仅对图文/图集作品生效;多个序号输入示例:"1 3 5 7"' ), width=55, ), ), - ("--work_path", "-wp", "str", _("作品数据 / 文件保存根路径")), + ("--work_path", "-wp", "str", _("作品数据/文件保存根路径")), ("--folder_name", "-fn", "str", _("作品文件储存文件夹名称")), ("--name_format", "-nf", "str", _("作品文件名称格式")), ("--user_agent", "-ua", "str", "User-Agent"), diff --git a/source/application/app.py b/source/application/app.py index b8580d0..516a0cb 100644 --- a/source/application/app.py +++ b/source/application/app.py @@ -253,7 +253,8 @@ class XHS: url = await self.extract_links(url, log) if not url: logging(log, _("提取小红书作品链接失败"), WARNING) - else: + return + if index: await self.__deal_extract( url[0], download, @@ -262,6 +263,18 @@ class XHS: bar, data, ) + else: + [ + await self.__deal_extract( + u, + download, + index, + log, + bar, + data, + ) + for u in url + ] async def extract_links(self, url: str, log) -> list: urls = [] diff --git a/static/Release_Notes.md b/static/Release_Notes.md index 42d69e9..549d7c0 100644 --- a/static/Release_Notes.md +++ b/static/Release_Notes.md @@ -3,15 +3,16 @@ 1. 修复作品类型判断失败时异常退出的问题 2. 修改服务器模式请求路径为 `/xhs/detail` 3. 修改服务器模式默认端口为 `5556` -4. 新增 `folder_name` 参数检查 -5. 服务器模式新增 MCP 模式 -6. 配置与文件归集到单文件夹 -7. 优化配置文件参数容错机制 -8. 优化提取链接的正则表达式 -9. 修改服务器模式启动命令 -10. 支持更多作品链接格式 -11. 支持音乐图集作品下载 -12. 其他细节优化 +4. 命令行模式支持传递多个作品链接 +5. 新增 `folder_name` 参数检查 +6. 服务器模式新增 MCP 模式 +7. 配置与文件归集到单文件夹 +8. 优化配置文件参数容错机制 +9. 优化提取链接的正则表达式 +10. 修改服务器模式启动命令 +11. 支持更多作品链接格式 +12. 支持音乐图集作品下载 +13. 其他细节优化 *****