迅雷网盘接口清单
来源:
backend/internal/drives/xunlei.go
抓包日志:backend/logs/drive-api-debug/xunlei.txt
1. 账号登录(OAuth2 password)
接口概览
| 项目 | 值 |
|---|---|
| 方法 | POST |
| URL | https://xluser-ssl.xunlei.com/v1/auth/signin |
| 作用 | 使用账号密码 + captcha_token 换取 access_token / refresh_token |
请求体参数
| 参数 | 说明 |
|---|---|
username | 手机号等,如 +86 1xxxxxxxxxx |
password | 密码 |
captcha_token | 登录前风控验证码 token(由项目内验证码流程获取) |
client_id | 日志为 ZUBzD9J_XPXfn7f7 |
client_secret | 日志为 yESVmHecEe6F0aou69vl-g |
请求示例
bash
curl --request POST \
--url 'https://xluser-ssl.xunlei.com/v1/auth/signin' \
--header 'Content-Type: application/json' \
--data '{"captcha_token":"<ck0...>","client_id":"ZUBzD9J_XPXfn7f7","client_secret":"yESVmHecEe6F0aou69vl-g","password":"<pwd>","username":"+86 1xxxxxxxxxx"}'响应示例(失败:验证码无效)
json
{
"error": "captcha_invalid",
"error_code": 4002,
"error_description": "..."
}响应示例(成功)
json
{
"token_type": "Bearer",
"access_token": "<JWT>",
"refresh_token": "<refresh>",
"expires_in": 7200,
"sub": "142174316",
"user_id": "142174316"
}2. 获取分享根信息
接口概览
| 项目 | 值 |
|---|---|
| 方法 | GET |
| URL | https://api-pan.xunlei.com/drive/v1/share |
| 作用 | 校验提取码、返回分享标题、根层文件列表、pass_code_token |
Query 参数
| 参数 | 说明 |
|---|---|
share_id | 分享 ID |
pass_code | 提取码 |
limit | 如 100 |
pass_code_token | 首次可为空,翻页等场景复用 |
page_token | 分页 |
thumbnail_size | 如 SIZE_SMALL |
请求头
| 头 | 说明 |
|---|---|
X-Captcha-Token | 分享接口风控 token |
X-Client-Id | 与登录一致 client_id |
X-Device-Id | 设备 ID(代码内固定示例) |
Origin / Referer | https://pan.xunlei.com |
响应示例(分享已删除)
json
{
"share_status": "DELETED",
"share_status_text": "分享已删除",
"file_num": "0",
"files": [],
"pass_code_token": "",
"user_info": { "user_id": "45061515", "nickname": "Sole20" }
}响应示例(成功,根为文件夹)
json
{
"share_status": "OK",
"file_num": "1",
"files": [
{
"kind": "drive#folder",
"id": "VOn5EARArTr3fLkln-jFaBfcA1",
"name": "侵略机器 War Machine (2026)",
"size": "0",
"folder_type": "NORMAL"
}
],
"pass_code_token": "69RM/BljR9tCoVB9wVHxJnan3BB37kNDp7Gzm5Oi3Nk...",
"title": "侵略机器 War Machine (2026)"
}3. 分享子目录详情
接口概览
| 项目 | 值 |
|---|---|
| 方法 | GET |
| URL | https://api-pan.xunlei.com/drive/v1/share/detail |
| 作用 | 列出某 parent_id 下文件/文件夹 |
Query 参数
| 参数 | 说明 |
|---|---|
share_id | 分享 ID |
parent_id | 父文件夹 ID |
limit | 如 999 |
pass_code_token | 来自 /share 响应,需 URL 编码 |
4. 转存分享文件到网盘
接口概览
| 项目 | 值 |
|---|---|
| 方法 | POST |
| URL | https://api-pan.xunlei.com/drive/v1/share/restore |
| 作用 | 将分享中文件保存到当前用户网盘 |
| 认证 | Authorization: Bearer <access_token> |
请求体要点(见 xunlei.go)
share_id、pass_code_token、file_ids、to_parent_id等。
5. 获取文件下载/直链信息
接口概览
| 项目 | 值 |
|---|---|
| 方法 | GET |
| URL | https://x-api-pan.xunlei.com/drive/v1/files/{file_id} |
| 作用 | with=url 时返回可下载地址等信息 |
Query 参数(示例)
| 参数 | 值 |
|---|---|
_magic | 2021 |
with | url |
thumbnail_size | SIZE_LARGE |
认证
Authorization: Bearer <access_token>
6. 删除文件(回收站)
- 方法:
PATCH - URL:
https://api-pan.xunlei.com/drive/v1/files/{file_id}/trash - Body:
{} - 本次日志未单独抓取响应,待补
