Skip to content

Commit 4e15e61

Browse files
authored
Merge pull request #199 from Ljzd-PRO/devel
Bump to v0.11.1
2 parents cf5c12c + 0bc547b commit 4e15e61

File tree

6 files changed

+131
-145
lines changed

6 files changed

+131
-145
lines changed

CHANGELOG.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
## Changes
22

3-
### 💡 Feature
3+
[//]: # (### 💡 Feature)
44

5-
- The `search-creator` command will include search results with similar names.
6-
- For example, the search parameter `--name abc` might return author information such as: `abc, abcd, hi-abc`
7-
- Share an HTTPX client to reuse underlying TCP connections through an HTTP connection pool when calling APIs and downloading,
8-
**significantly improving query and download speeds as well as connection stability**
5+
### 🪲 Fix
96

10-
[//]: # (### 🪲 Fix)
7+
- Update the API for retrieving post information and fix the `get-post` and `download-post` commands (#198) (#180)
118

12-
- - -
9+
[//]: # (### 💡 新特性)
1310

14-
### 💡 新特性
11+
### 🪲 修复
1512

16-
- search-creator 搜索作者的命令将包含那些名字相近的搜索结果
17-
- 如搜索参数 `--name abc` 可能得到如下作者信息:`abc, abcd, hi-abc`
18-
- 共享 HTTPX 客户端,调用 API 和下载时将通过 HTTP 连接池重用底层 TCP 连接,**显著提升查询、下载速度和连接稳定性**
13+
- 更新获取作品信息的 API,修复 `get-post``download-post` 命令 (#198) (#180)
1914

20-
[//]: # (### 🪲 修复)
21-
22-
**Full Changelog**: https://github.com/Ljzd-PRO/KToolBox/compare/v0.10.0...v0.11.0
15+
**Full Changelog**: https://github.com/Ljzd-PRO/KToolBox/compare/v0.11.0...v0.11.1

ktoolbox/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
__title__ = "KToolBox"
22
# noinspection SpellCheckingInspection
33
__description__ = "A useful CLI tool for downloading posts in Kemono.party / .su"
4-
__version__ = "v0.11.0"
4+
__version__ = "v0.11.1"

ktoolbox/api/posts/get_post.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from pydantic import BaseModel
2+
13
from ktoolbox.api import BaseAPI, APIRet
24
from ktoolbox.api.model import Post
35

@@ -8,11 +10,11 @@ class GetPost(BaseAPI):
810
path = "/{service}/user/{creator_id}/post/{post_id}"
911
method = "get"
1012

11-
class Response(Post):
12-
...
13+
class Response(BaseModel):
14+
post: Post
1315

1416
@classmethod
15-
async def __call__(cls, service: str, creator_id: str, post_id: str) -> APIRet[Post]:
17+
async def __call__(cls, service: str, creator_id: str, post_id: str) -> APIRet[Response]:
1618
"""
1719
Get a specific post
1820

ktoolbox/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ async def get_post(service: str, creator_id: str, post_id: str, *, dump: Path =
134134
if dump:
135135
async with aiofiles.open(str(dump), "w", encoding="utf-8") as f:
136136
await f.write(
137-
ret.data.model_dump_json(indent=config.json_dump_indent)
137+
ret.data.post.model_dump_json(indent=config.json_dump_indent)
138138
)
139-
return ret.data
139+
return ret.data.post
140140
else:
141141
return ret.message
142142

@@ -201,9 +201,9 @@ async def download_post(
201201
post_id=post_id
202202
)
203203
if ret:
204-
post_path = path / generate_post_path_name(ret.data)
204+
post_path = path / generate_post_path_name(ret.data.post)
205205
job_list = await create_job_from_post(
206-
post=ret.data,
206+
post=ret.data.post,
207207
post_path=post_path,
208208
dump_post_data=dump_post_data
209209
)

0 commit comments

Comments
 (0)