Skip to content

kysdm/u2_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

U2-API V2 Documentation

注意:

  1. 当您失去 U2 的访问权限时,您也会立即失去此 API 的访问权限。
  2. Token 限制:每用户至多生效 7 个,每个 Token 有效期为 45 天。
  3. 自动续期:每次成功请求 API,Token 有效期自动刷新。
  4. 鉴权方式:所有非登录接口必须在 HTTP Header 中携带 Authorization: Bearer <your_token>

Base URL: https://u2.kysdm.com/api/v2

U2分享園@動漫花園

1. 认证

1.1 获取验证 Key (Step 1)

POST /auth/key

参数 类型 必选 默认值 说明
uid int - U2 账户 ID

响应下一步: 请将返回的 key 值写入 U2 个人说明 中。

1.2 获取 Token (Step 2)

POST /auth/token

参数 类型 必选 默认值 说明
uid int - U2 账户 ID
key string - 上一步获取的 Key

响应: 返回 token


2. 魔法

2.1 查询全站魔法

获取当前的全局魔法列表。

GET /promotions

参数 类型 必选 默认值 说明
scope string all 魔法类型: global, public, private, all
limit int 10 返回条数 (最大 60)

2.2 查询特定魔法

GET /promotions/{id}

参数 类型 必选 默认值 说明
id int - 魔法 ID

2.3 查询种子当前有效魔法

GET /promotions/active

参数 类型 必选 默认值 说明
torrent_id int - 种子 ID

2.4 计算魔法叠加

GET /promotions/summary

参数 类型 必选 默认值 说明
torrent_id int - 种子 ID
valid_uid int 请求者 UID 仅 type=super 有效
筛选对此用户生效的魔法

3. 种子

包含普通种子、候选种子(Offers)以及各类筛选。

3.1 近期种子列表

GET /torrents

参数 类型 必选 默认值 说明
scope string normal 种子状态:
normal 普通种子
offer 候选种子
limit int 10 返回条数 (最大 50)
simple int 2 信息详略:
0 完整
1 简略(无文件树)
2 极简

3.2 做种人数范围筛选

缓存: 300s

GET /torrents/filter/seeders-count

参数 类型 必选 默认值 说明
min_seeders int 1 最小做种人数
max_seeders int 1 最大做种人数
offset int - 偏移量
limit int 10 返回条数 (最大 100)

3.3 种子体积排序

GET /torrents/filter/size

不包含候选中的种子

参数 类型 必选 默认值 说明
order string desc 排序方向:
asc 升序
desc 降序
offset int - 偏移量
limit int 10 返回条数 (最大 100)

3.4 获取单个种子详情

GET /torrents/{id}

参数 类型 必选 默认值 说明
id int - 种子 ID

GET /torrents/by-hash/{hash}

参数 类型 必选 默认值 说明
hash string - 种子 Hash

3.5 种子修改历史

GET /torrents/{id}/history

参数 类型 必选 默认值 说明
id int - 种子 ID
limit int 3 返回条数 (最大 100)

GET /torrents/by-hash/{hash}/history

参数 类型 必选 默认值 说明
hash string - 种子 Hash
limit int 3 返回条数 (最大 100)

3.6 种子下载列表

缓存: 600s | 频率限制: 5次/60s

GET /torrents/{id}/peers

参数 类型 必选 默认值 说明
id int - 种子 ID

3.7 目录名模糊搜索

通过种子根目录名称反查种子。

模糊搜索使用示例
>> '%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)

3.8 种子体积搜索

根据种子的精确字节大小,查询对应的种子列表,并返回种子的存活状态。

GET /torrents/search/by-size

参数 类型 必选 默认值 说明
size int - 种子的精确体积(字节单位)

3.9 种子 SHA256 信息

GET /torrents/{id}/checksum

参数 类型 必选 默认值 说明
id int - 种子 ID

3.10 文件 Hash 搜索

通过 SHA256 值查询文件所属的种子路径。

POST /torrents/search/by-file-hashes

参数 类型 必选 默认值 说明
hashes list[string] - 文件的 SHA256 值列表 (最大 100)

3.11 候选种子近期投票

GET /torrents/vote/status

参数 类型 必选 默认值 说明
limit int 10 返回条数 (最大 100)

3.12 候选种子投票状态

GET /torrents/{id}/vote/status

参数 类型 必选 默认值 说明
id int - 种子 ID

4. 用户

4.1 用户邀请信息

GET /users/{id}

参数 类型 必选 默认值 说明
id int - 用户 ID
direction string up 邀请方向:
up (上级/邀请人)
down (下级/被邀请人)
simple boolean false 不包含改名记录

4.2 在线邀请树详情

在线查询 https://u2invitetree.kysdm.workers.dev/

GET /users/{id}/invitation-tree

参数 类型 必选 默认值 说明
id int - 用户 ID
simple boolean false 不包含改名记录

4.3 用户候选投票统计

GET /users/{id}/vote/stats

参数 类型 必选 默认值 说明
id int - 用户 ID

5. 论坛

较高频率抓取 (前3页新种子 / 候选区 / 论坛第一页帖子)
极低频率抓取 (除较高频率抓取的)
不实时抓取用户编辑操作,仅当帖子/种子出现新评论后,才抓取编辑操作。 (编辑操作只有进入帖子/种子后才能看到,又没有 API 可以 PY,要实时抓取,就要频繁的请求。)

注:评论中的电子邮箱经过脱敏处理

5.1 近期论坛评论

GET /comments/forum

参数 类型 必选 默认值 说明
limit int 3 返回条数 (最大 30)

5.2 近期种子评论

GET /comments/torrents

参数 类型 必选 默认值 说明
limit int 3 返回条数 (最大 30)

5.3 搜索种子评论

GET /comments/torrents/search

参数 类型 必选 默认值 说明
keywords int - 搜索关键词
desired_user_id int - 发帖人 UID
offset int - 偏移量

5.4 论坛帖子 ID 查询

GET /comments/forum/{topicid}

参数 类型 必选 默认值 说明
topicid int - 论坛帖子 ID

5.5 论坛帖子楼层 ID 查询

GET /comments/forum/pid/{pid}

参数 类型 必选 默认值 说明
pid int - 论坛帖子楼层 ID

5.6 种子 ID 评论查询

GET /comments/torrents/{torrent_id}

参数 类型 必选 默认值 说明
torrent_id int - 种子 ID

5.7 种子楼层 ID 评论查询

GET /comments/torrents/cid/{cid}

参数 类型 必选 默认值 说明
cid int - 种子楼层 ID

6. 聊天室

6.1 近期聊天室消息

GET /chat/messages

参数 类型 必选 默认值 说明
limit int 10 返回条数 (最大 100)

7. 系统

7.1 邀请价格监控

GET /system/invite-price

参数 类型 必选 默认值 说明
limit int 50 返回条数 (最大 500)

7.2 日志

GET /system/logs

参数 类型 必选 默认值 说明
limit int 10 返回条数 (最大 60)

7.3 公告

GET /system/announcements

参数 类型 必选 默认值 说明
limit int 10 返回条数 (最大 10)

7.4 版本库

U2开发日志

GET /system/repositories

参数 类型 必选 默认值 说明
limit int 10 返回条数 (最大 15)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors