From b63f546b3a0e4797a101c5472cd95ddb1a800688 Mon Sep 17 00:00:00 2001 From: Quan Date: Mon, 28 Jul 2025 17:00:07 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=94=AF=E6=8C=81=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E9=93=BE=E6=8E=A5=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #272 --- README.md | 11 ----------- README_EN.md | 12 ------------ requirements.txt | 2 +- source/application/app.py | 3 +++ static/Release_Notes.md | 11 +++++------ uv.lock | 13 +++++++------ 6 files changed, 16 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 9c28e19..223a345 100644 --- a/README.md +++ b/README.md @@ -247,7 +247,6 @@ async def example(): """通过代码设置参数,适合二次开发""" # 示例链接 demo_link = "https://www.xiaohongshu.com/explore/XXX?xsec_token=XXX" - # 实例对象 work_path = "D:\\" # 作品数据/文件保存根路径,默认值:项目根路径 folder_name = "Download" # 作品文件储存文件夹名称(自动创建),默认值:Download @@ -269,10 +268,8 @@ async def example(): author_archive = True # 是否将每个作者的作品存至单独的文件夹 write_mtime = True # 是否将作品文件的 修改时间 修改为作品的发布时间 read_cookie = None # 读取浏览器 Cookie,支持设置浏览器名称(字符串)或者浏览器序号(整数),设置为 None 代表不读取 - # async with XHS() as xhs: # pass # 使用默认参数 - async with XHS( work_path=work_path, folder_name=folder_name, @@ -616,14 +613,6 @@ A: 由于权限限制,您无法直接触发主仓库的 Actions。请通过 Fo # 💰 项目赞助 -## JetBrains 工具 - -![PyCharm logo](https://resources.jetbrains.com/storage/products/company/brand/logos/PyCharm.svg) - -**JetBrains** 支持全球开源社区认可的活跃项目,并为非商业开发提供免费许可证。 - -*** - ## DartNode [![Powered by DartNode](https://dartnode.com/branding/DN-Open-Source-sm.png)](https://dartnode.com "Powered by DartNode - Free VPS for Open Source") diff --git a/README_EN.md b/README_EN.md index 970200b..9601157 100644 --- a/README_EN.md +++ b/README_EN.md @@ -253,7 +253,6 @@ async def example(): """通过代码设置参数,适合二次开发""" # 示例链接 demo_link = "https://www.xiaohongshu.com/explore/XXX?xsec_token=XXX" - # 实例对象 work_path = "D:\\" # 作品数据/文件保存根路径,默认值:项目根路径 folder_name = "Download" # 作品文件储存文件夹名称(自动创建),默认值:Download @@ -275,10 +274,8 @@ async def example(): author_archive = True # 是否将每个作者的作品存至单独的文件夹 write_mtime = True # 是否将作品文件的 修改时间 修改为作品的发布时间 read_cookie = None # 读取浏览器 Cookie,支持设置浏览器名称(字符串)或者浏览器序号(整数),设置为 None 代表不读取 - # async with XHS() as xhs: # pass # 使用默认参数 - async with XHS( work_path=work_path, folder_name=folder_name, @@ -315,7 +312,6 @@ async def example(): ], ) ) -

📋 Read Clipboard

The project uses pyperclip to implement clipboard reading functionality, which varies across different systems.

@@ -644,14 +640,6 @@ repository to execute the build process # 💰 Project Sponsorship -## JetBrains Tools - -![PyCharm logo](https://resources.jetbrains.com/storage/products/company/brand/logos/PyCharm.svg) - -

JetBrains support active projects recognized within the global open-source community with complimentary licenses for non-commercial development.

- -*** - ## DartNode [![Powered by DartNode](https://dartnode.com/branding/DN-Open-Source-sm.png)](https://dartnode.com "Powered by DartNode - Free VPS for Open Source") diff --git a/requirements.txt b/requirements.txt index a819c49..16f55ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ pyyaml==6.0.2 # via xhs-downloader (pyproject.toml) rookiepy==0.5.6 # via xhs-downloader (pyproject.toml) -textual==3.1.0 +textual==5.0.1 # via xhs-downloader (pyproject.toml) uvicorn==0.34.2 # via xhs-downloader (pyproject.toml) diff --git a/source/application/app.py b/source/application/app.py index ddf5bf2..188e7a1 100644 --- a/source/application/app.py +++ b/source/application/app.py @@ -75,6 +75,7 @@ class XHS: VERSION_MINOR = VERSION_MINOR VERSION_BETA = VERSION_BETA LINK = compile(r"https?://www\.xiaohongshu\.com/explore/\S+") + USER = compile(r"https?://www\.xiaohongshu\.com/user/profile/[a-z0-9]+/\S+") SHARE = compile(r"https?://www\.xiaohongshu\.com/discovery/item/\S+") SHORT = compile(r"https?://xhslink\.com/[^\s\"<>\\^`{|},。;!?、【】《》]+") ID = compile(r"(?:explore|item)/(\S+)?\?") @@ -276,6 +277,8 @@ class XHS: urls.append(u.group()) elif u := self.LINK.search(i): urls.append(u.group()) + elif u := self.USER.search(i): + urls.append(u.group()) return urls def extract_id(self, links: list[str]) -> list[str]: diff --git a/static/Release_Notes.md b/static/Release_Notes.md index 59ed96d..d4d2687 100644 --- a/static/Release_Notes.md +++ b/static/Release_Notes.md @@ -3,9 +3,9 @@ 1. 修复作品类型判断失败时异常退出的问题 2. 修改服务器模式请求路径为 `/xhs/detail` 3. 服务器模式支持通过 MCP 调用 -4. 修复部分图文作品下载失败的问题 -5. 修改服务器模式默认端口为 `5556` -6. 优化提取链接的正则表达式 +4. 修改服务器模式默认端口为 `5556` +5. 优化提取链接的正则表达式 +6. 支持更多作品链接格式 7. 支持音乐图集作品下载 8. 其他细节优化 @@ -13,8 +13,7 @@ **用户脚本更新内容:** -**版本号:2.0.3** +**版本号:2.0.4** 1. 修复单张图片的作品下载后文件损坏问题 -2. 修复部分图文作品下载失败的问题 -3. 修复用户脚本 CSS 样式冲突问题 +2. 修复用户脚本 CSS 样式冲突问题 diff --git a/uv.lock b/uv.lock index 1b7abf9..ec47e86 100644 --- a/uv.lock +++ b/uv.lock @@ -736,11 +736,11 @@ wheels = [ [[package]] name = "pygments" -version = "2.19.1" +version = "2.19.2" source = { registry = "https://mirrors.ustc.edu.cn/pypi/simple" } -sdist = { url = "https://mirrors.ustc.edu.cn/pypi/packages/7c/2d/c3338d48ea6cc0feb8446d8e6937e1408088a72a39937982cc6111d17f84/pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f", size = 4968581 } +sdist = { url = "https://mirrors.ustc.edu.cn/pypi/packages/b0/77/a5b8c569bf593b0140bde72ea885a803b82086995367bf2037de0159d924/pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887", size = 4968631 } wheels = [ - { url = "https://mirrors.ustc.edu.cn/pypi/packages/8a/0b/9fcc47d19c48b59121088dd6da2488a49d5f72dacf8262e2790a1d2c7d15/pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c", size = 1225293 }, + { url = "https://mirrors.ustc.edu.cn/pypi/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217 }, ] [[package]] @@ -917,17 +917,18 @@ wheels = [ [[package]] name = "textual" -version = "3.5.0" +version = "5.0.1" source = { registry = "https://mirrors.ustc.edu.cn/pypi/simple" } dependencies = [ { name = "markdown-it-py", extra = ["linkify", "plugins"] }, { name = "platformdirs" }, + { name = "pygments" }, { name = "rich" }, { name = "typing-extensions" }, ] -sdist = { url = "https://mirrors.ustc.edu.cn/pypi/packages/0c/63/16cdf4b9efb47366940d8315118c5c6dd6309f5eb2c159d7195b60e2e221/textual-3.5.0.tar.gz", hash = "sha256:c4a440338694672acf271c74904f1cf1e4a64c6761c056b02a561774b81a04f4", size = 1590084 } +sdist = { url = "https://mirrors.ustc.edu.cn/pypi/packages/ca/45/44120c661037e64b80518871a800a0bd18c13aab4b68711b774f3b9d58b1/textual-5.0.1.tar.gz", hash = "sha256:c6e20489ee585ec3fa43b011aa575f52e4fafad550e040bff9f53a464897feb6", size = 1611533 } wheels = [ - { url = "https://mirrors.ustc.edu.cn/pypi/packages/1f/36/2597036cb80e40f71555bf59741471f7bd76ebed112f10ae0549650a12bf/textual-3.5.0-py3-none-any.whl", hash = "sha256:7c960efb70391b754e66201776793de2b26d699d51fb91f5f78401d13cec79a1", size = 688740 }, + { url = "https://mirrors.ustc.edu.cn/pypi/packages/cf/94/976d89db23efed9f3114403faf3f767ec707bfca469a93d0fb715cd352fa/textual-5.0.1-py3-none-any.whl", hash = "sha256:816eab21d22a702b3858ee23615abccaf157c05d386e82968000084c3c2c26aa", size = 699674 }, ] [[package]]