Skip to content

Commit 06b25ca

Browse files
committed
doc: 添加下载端口说明
1 parent 9ee5fde commit 06b25ca

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,56 @@ uv run bs -c config/config.toml
9595

9696
![image](https://github.com/user-attachments/assets/76c298d7-6437-4e12-8333-a80f4802b8d1)
9797

98+
99+
# 手动下载接口
100+
101+
服务启动后,可以通过 HTTP API 手动添加 Bilibili 视频下载任务。
102+
103+
```http
104+
POST /api/task/bili
105+
Content-Type: application/json
106+
```
107+
108+
请求参数:
109+
110+
| 字段 | 类型 | 必填 | 说明 |
111+
| --- | --- | --- | --- |
112+
| `bid` | string | 是 | Bilibili 视频 BV 号,例如 `BV1xxxx` |
113+
| `favid` | string | 否 | 收藏夹 id,默认 `-1`。`-1` 表示通过 API 手动添加的任务 |
114+
| `selected_episodes` | number[] | 否 | 需要下载的分 P 索引列表,不传则下载全部分 P |
115+
116+
示例:
117+
118+
```bash
119+
curl -X POST "http://127.0.0.1:8000/api/task/bili" \
120+
-H "Content-Type: application/json" \
121+
-d '{
122+
"bid": "BV1xxxx",
123+
"favid": "-1",
124+
"selected_episodes": [0, 1]
125+
}'
126+
```
127+
128+
返回示例:
129+
130+
```json
131+
{
132+
"status": "success",
133+
"message": "Task BV1xxxx added to database",
134+
"task_id": 1
135+
}
136+
```
137+
138+
如果任务已存在,接口会更新任务上下文;当已存在任务处于 `failed` 或 `completed` 状态时,会重置为待下载状态。
139+
140+
手动下载任务默认使用 `favid = -1`,需要在配置文件中为该任务配置下载目录:
141+
142+
```toml
143+
[favorite_list.task0]
144+
fid = -1
145+
path = "sync/"
146+
```
147+
98148
# 更新日志
99149

100150
[CHANGELOG](./CHANGELOG.md)

0 commit comments

Comments
 (0)