mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2026-03-22 06:57:16 +08:00
style(XHS-Downloader): 代码格式化和依赖项更新
- 使用自动代码格式化工具对代码进行了统一格式化 - 更新了项目依赖项至最新版本 - 调整了部分代码结构以符合规范
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user