From 71278527e12093c91a88db6481c923eaa70dd051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=A8?= Date: Tue, 18 Feb 2025 20:00:13 +0800 Subject: [PATCH] =?UTF-8?q?style(XHS-Downloader):=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E5=92=8C=E4=BE=9D=E8=B5=96=E9=A1=B9?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用自动代码格式化工具对代码进行了统一格式化 - 更新了项目依赖项至最新版本 - 调整了部分代码结构以符合规范 --- requirements.txt | 38 +++++++++++++++++++++++++------------ source/application/app.py | 2 +- source/application/image.py | 13 +++++++++++-- source/module/manager.py | 9 ++++++++- 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/requirements.txt b/requirements.txt index 344b418..f236db9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,26 @@ -aiofiles>=24.1.0 -aiosqlite>=0.21.0 -click>=8.1.8 -emoji>=2.14.1 -fastapi>=0.115.8 -httpx[socks]>=0.28.1 -lxml>=5.3.1 -pyperclip>=1.9.0 -pyyaml>=6.0.2 -rookiepy>=0.5.6 -textual>=1.0.0 -uvicorn>=0.34.0 +# This file was autogenerated by uv via the following command: +# uv pip compile pyproject.toml --no-deps -o requirements.txt +aiofiles==24.1.0 + # via xhs-downloader (pyproject.toml) +aiosqlite==0.21.0 + # via xhs-downloader (pyproject.toml) +click==8.1.8 + # via xhs-downloader (pyproject.toml) +emoji==2.14.1 + # via xhs-downloader (pyproject.toml) +fastapi==0.115.8 + # via xhs-downloader (pyproject.toml) +httpx==0.28.1 + # via xhs-downloader (pyproject.toml) +lxml==5.3.1 + # via xhs-downloader (pyproject.toml) +pyperclip==1.9.0 + # via xhs-downloader (pyproject.toml) +pyyaml==6.0.2 + # via xhs-downloader (pyproject.toml) +rookiepy==0.5.6 + # via xhs-downloader (pyproject.toml) +textual==2.0.4 + # via xhs-downloader (pyproject.toml) +uvicorn==0.34.0 + # via xhs-downloader (pyproject.toml) diff --git a/source/application/app.py b/source/application/app.py index 1be8c10..5445744 100644 --- a/source/application/app.py +++ b/source/application/app.py @@ -34,7 +34,7 @@ from source.module import ( VERSION_MAJOR, VERSION_MINOR, VERSION_BETA, - __VERSION__ + __VERSION__, ) from source.module import logging from source.module import sleep_time diff --git a/source/application/image.py b/source/application/image.py index 1d62f9f..c6f8cf5 100644 --- a/source/application/image.py +++ b/source/application/image.py @@ -16,7 +16,13 @@ class Image: match format_: case "png" | "webp" | "jpeg" | "heic" | "avif": return [ - Html.format_url(cls.__generate_fixed_link(i, format_, )) for i in token_list + Html.format_url( + cls.__generate_fixed_link( + i, + format_, + ) + ) + for i in token_list ], live_link case "auto": return [ @@ -30,7 +36,10 @@ class Image: return f"https://sns-img-bd.xhscdn.com/{token}" @staticmethod - def __generate_fixed_link(token: str, format_: str, ) -> str: + def __generate_fixed_link( + token: str, + format_: str, + ) -> str: return f"https://ci.xiaohongshu.com/{token}?imageView2/format/{format_}" @staticmethod diff --git a/source/module/manager.py b/source/module/manager.py index b619b63..f9644c1 100644 --- a/source/module/manager.py +++ b/source/module/manager.py @@ -138,7 +138,14 @@ class Manager: @staticmethod def __check_image_format(image_format) -> str: - if (i := image_format.lower()) in {"auto", "png", "webp", "jpeg", "heic", "avif", }: + if (i := image_format.lower()) in { + "auto", + "png", + "webp", + "jpeg", + "heic", + "avif", + }: return i return "png"