注意:
- 当您失去 U2 的访问权限时,您也会立即失去此 API 的访问权限。
- Token 限制:每用户至多生效 7 个,每个 Token 有效期为 45 天。
- 自动续期:每次成功请求 API,Token 有效期自动刷新。
- 鉴权方式:所有非登录接口必须在 HTTP Header 中携带
Authorization: Bearer <your_token>。
Base URL: https://u2.kysdm.com/api/v2
POST /auth/key
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
uid |
int | 是 | - | U2 账户 ID |
响应下一步: 请将返回的 key 值写入 U2 个人说明 中。
POST /auth/token
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
uid |
int | 是 | - | U2 账户 ID |
key |
string | 是 | - | 上一步获取的 Key |
响应: 返回 token。
获取当前的全局魔法列表。
GET /promotions
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
scope |
string | 否 | all |
魔法类型: global, public, private, all |
limit |
int | 否 | 10 | 返回条数 (最大 60) |
GET /promotions/{id}
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
id |
int | 是 | - | 魔法 ID |
GET /promotions/active
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
torrent_id |
int | 是 | - | 种子 ID |
GET /promotions/summary
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
torrent_id |
int | 是 | - | 种子 ID |
valid_uid |
int | 否 | 请求者 UID | 仅 type=super 有效。 筛选对此用户生效的魔法 |
包含普通种子、候选种子(Offers)以及各类筛选。
GET /torrents
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
scope |
string | 否 | normal |
种子状态:normal 普通种子offer 候选种子 |
limit |
int | 否 | 10 | 返回条数 (最大 50) |
simple |
int | 否 | 2 | 信息详略:0 完整1 简略(无文件树)2 极简 |
缓存: 300s
GET /torrents/filter/seeders-count
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
min_seeders |
int | 否 | 1 | 最小做种人数 |
max_seeders |
int | 否 | 1 | 最大做种人数 |
offset |
int | 否 | - | 偏移量 |
limit |
int | 否 | 10 | 返回条数 (最大 100) |
GET /torrents/filter/size
不包含候选中的种子
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
order |
string | 否 | desc |
排序方向:asc 升序desc 降序 |
offset |
int | 否 | - | 偏移量 |
limit |
int | 否 | 10 | 返回条数 (最大 100) |
GET /torrents/{id}
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
id |
int | 是 | - | 种子 ID |
GET /torrents/by-hash/{hash}
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
hash |
string | 是 | - | 种子 Hash |
GET /torrents/{id}/history
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
id |
int | 是 | - | 种子 ID |
limit |
int | 否 | 3 | 返回条数 (最大 100) |
GET /torrents/by-hash/{hash}/history
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
hash |
string | 是 | - | 种子 Hash |
limit |
int | 否 | 3 | 返回条数 (最大 100) |
缓存: 600s | 频率限制: 5次/60s
GET /torrents/{id}/peers
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
id |
int | 是 | - | 种子 ID |
通过种子根目录名称反查种子。
模糊搜索使用示例
>> '%ababcc%' 可匹配 "__abcabc__"
>> 'abcabc%' 可匹配 "abcabc__"
>> '%abcabc' 可匹配 "__abcabc"
GET /torrents/search/by-directory
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
query |
string | 是 | - | 搜索关键词 (支持 % 通配符,需要启用 fuzzy 参数) |
fuzzy |
boolean | 否 | false |
是否启用模糊搜索 (query 长度需 >= 6) |
offset |
int | 否 | - | 偏移量 |
limit |
int | 否 | 10 | 返回条数 (最大 100) |
根据种子的精确字节大小,查询对应的种子列表,并返回种子的存活状态。
GET /torrents/search/by-size
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
size |
int | 是 | - | 种子的精确体积(字节单位) |
GET /torrents/{id}/checksum
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
id |
int | 是 | - | 种子 ID |
通过 SHA256 值查询文件所属的种子路径。
POST /torrents/search/by-file-hashes
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
hashes |
list[string] | 是 | - | 文件的 SHA256 值列表 (最大 100) |
GET /torrents/vote/status
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
limit |
int | 否 | 10 | 返回条数 (最大 100) |
GET /torrents/{id}/vote/status
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
id |
int | 是 | - | 种子 ID |
GET /users/{id}
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
id |
int | 是 | - | 用户 ID |
direction |
string | 否 | up |
邀请方向:up (上级/邀请人)down (下级/被邀请人) |
simple |
boolean | 否 | false |
不包含改名记录 |
GET /users/{id}/invitation-tree
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
id |
int | 是 | - | 用户 ID |
simple |
boolean | 否 | false |
不包含改名记录 |
GET /users/{id}/vote/stats
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
id |
int | 是 | - | 用户 ID |
较高频率抓取 (前3页新种子 / 候选区 / 论坛第一页帖子)
极低频率抓取 (除较高频率抓取的)
不实时抓取用户编辑操作,仅当帖子/种子出现新评论后,才抓取编辑操作。 (编辑操作只有进入帖子/种子后才能看到,又没有 API 可以 PY,要实时抓取,就要频繁的请求。)
注:评论中的电子邮箱经过脱敏处理
GET /comments/forum
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
limit |
int | 否 | 3 | 返回条数 (最大 30) |
GET /comments/torrents
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
limit |
int | 否 | 3 | 返回条数 (最大 30) |
GET /comments/torrents/search
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
keywords |
int | 是 | - | 搜索关键词 |
desired_user_id |
int | 否 | - | 发帖人 UID |
offset |
int | 否 | - | 偏移量 |
GET /comments/forum/{topicid}
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
topicid |
int | 是 | - | 论坛帖子 ID |
GET /comments/forum/pid/{pid}
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
pid |
int | 是 | - | 论坛帖子楼层 ID |
GET /comments/torrents/{torrent_id}
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
torrent_id |
int | 是 | - | 种子 ID |
GET /comments/torrents/cid/{cid}
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
cid |
int | 是 | - | 种子楼层 ID |
GET /chat/messages
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
limit |
int | 否 | 10 | 返回条数 (最大 100) |
GET /system/invite-price
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
limit |
int | 否 | 50 | 返回条数 (最大 500) |
GET /system/logs
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
limit |
int | 否 | 10 | 返回条数 (最大 60) |
GET /system/announcements
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
limit |
int | 否 | 10 | 返回条数 (最大 10) |
U2开发日志
GET /system/repositories
| 参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|
limit |
int | 否 | 10 | 返回条数 (最大 15) |
