feat: init media-center skill
资源中心——从多渠道获取资源链接,转存到夸克网盘并整理归档。 - sources/tencent-doc: 腾讯文档读取 - sources/search: 网盘搜索 - storage/quark: 夸克网盘操作 - ref/: 来源 skill 参考归档 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
# 夸克网盘 — 安装配置
|
||||
|
||||
## 前置依赖
|
||||
|
||||
- Node.js >= 18
|
||||
- mcporter
|
||||
- curl(Windows Git Bash 自带)
|
||||
|
||||
```bash
|
||||
mcporter --version || npm i -g mcporter
|
||||
```
|
||||
|
||||
## 安装 MCP Server
|
||||
|
||||
```bash
|
||||
npm i -g @ptbsare/netdisk-mcp-server
|
||||
```
|
||||
|
||||
## 配置到 mcporter
|
||||
|
||||
### 1. 获取夸克 Cookie
|
||||
|
||||
浏览器打开 [pan.quark.cn](https://pan.quark.cn/) 并登录 → F12 开发者工具 → Network 标签 → 刷新页面 → 复制任意请求的 `Cookie` 请求头完整内容。
|
||||
|
||||
### 2. 配置
|
||||
|
||||
```bash
|
||||
mcporter config add netdisk \
|
||||
--stdio "npx -y @ptbsare/netdisk-mcp-server" \
|
||||
--env "NETDISK_QUARK_COOKIE=粘贴你的完整Cookie"
|
||||
```
|
||||
|
||||
> Cookie 是敏感信息,建议保存在单独的文件(如 `项目根目录/cookie/quark.txt`)中,
|
||||
> 使用时 `COOKIE=$(cat cookie/quark.txt)`,避免在命令行历史中泄露。
|
||||
|
||||
### 3. 验证
|
||||
|
||||
```bash
|
||||
mcporter call netdisk.health
|
||||
```
|
||||
|
||||
输出 ✅ `Quark: Quark cookie is valid` 表示成功。
|
||||
|
||||
```bash
|
||||
# 列出根目录
|
||||
mcporter call 'netdisk.list(cloud: "quark", path: "/")'
|
||||
```
|
||||
|
||||
## API 补全配置
|
||||
|
||||
MCP 工具缺少创建文件夹/移动/删除功能,这些操作通过直调 Quark API 实现。API 调用同样使用 Cookie 认证,无需额外配置。
|
||||
|
||||
API base URL:`https://drive-h.quark.cn`
|
||||
|
||||
```bash
|
||||
# 验证 API 连通性
|
||||
curl -s "https://drive-h.quark.cn/1/clouddrive/file/sort?pr=ucpro&fr=pc&pdir_fid=0" \
|
||||
-H "cookie: 你的Cookie" | head -c 200
|
||||
```
|
||||
|
||||
## 文件整理
|
||||
|
||||
整理功能(建目录/移动/删除)依赖 Quark API 直调,详见 `usage.md` 中的对应章节。
|
||||
@@ -0,0 +1,72 @@
|
||||
# 夸克网盘 — 维护
|
||||
|
||||
## 信息来源
|
||||
|
||||
| 当前模块内容 | 来源(ref/ 路径) | 说明 |
|
||||
|-------------|------------------|------|
|
||||
| MCP 安装配置 | `ref/netdisk-mcp-server/SKILL.md` | netdisk-mcp-server 官方文档 |
|
||||
| 转存/浏览/查看 | `ref/netdisk-mcp-server/SKILL.md`、`ref/netdisk-mcp-server/src/client.ts` | MCP 工具用法 + API 端点参考 |
|
||||
| 创建文件夹/移动/删除 | `ref/quark-netdisk-helper/SKILL.md` | API 补全方案 |
|
||||
| 整理工作流 | `ref/resource-pipeline/SKILL.md` | 整体编排思路参考 |
|
||||
|
||||
## 常见故障
|
||||
|
||||
### 1. Cookie 过期
|
||||
|
||||
**现象**:
|
||||
```
|
||||
mcporter call netdisk.health
|
||||
# ❌ Quark: Quark cookie expired or invalid (401/403)
|
||||
```
|
||||
|
||||
**解决**:重新登录 pan.quark.cn → F12 → Network 复制新 Cookie
|
||||
|
||||
```bash
|
||||
mcporter config add netdisk \
|
||||
--stdio "npx -y @ptbsare/netdisk-mcp-server" \
|
||||
--env "NETDISK_QUARK_COOKIE=新Cookie" \
|
||||
--overwrite
|
||||
```
|
||||
|
||||
### 2. 函数式语法报错
|
||||
|
||||
**现象**:
|
||||
```
|
||||
Error: Folder not found in Quark: "D:" (path: D:/work/environment/Git/)
|
||||
```
|
||||
|
||||
**原因**:使用了 `key=value` 语法
|
||||
|
||||
**解决**:改用 `'netdisk.list(cloud: "quark", path: "/")'`
|
||||
|
||||
### 3. 转存报错"Folder not found"
|
||||
|
||||
**现象**:`Folder not found in Quark: "新目录"`
|
||||
|
||||
**原因**:`target_path` 目录不存在
|
||||
|
||||
**解决**:先用 API 创建目录,再转存(见 usage.md)
|
||||
|
||||
### 4. 转存混入杂文件
|
||||
|
||||
**原因**:`source_pattern` 的 glob 跨所有文件夹匹配
|
||||
|
||||
**解决**:转存后用 `netdisk.list` 验证,用 API 删除杂文件
|
||||
|
||||
### 5. Quark API 调用失败
|
||||
|
||||
**可能原因**:Cookie 过期 / API 端点变更 / 请求频率过高
|
||||
|
||||
**解决**:参考 `ref/netdisk-mcp-server/src/client.ts` 查看最新的 API 端点
|
||||
|
||||
## 更新检查
|
||||
|
||||
```bash
|
||||
# 查看 MCP 版本
|
||||
npm ls -g @ptbsare/netdisk-mcp-server
|
||||
npm i -g @ptbsare/netdisk-mcp-server@latest
|
||||
```
|
||||
|
||||
GitHub 仓库:[github.com/ptbsare/netdisk-mcp-server](https://github.com/ptbsare/netdisk-mcp-server)
|
||||
|
||||
当 `ref/` 中对应的参考项目有更新时,同步到本模块的 `v2/` 版本。
|
||||
@@ -0,0 +1,188 @@
|
||||
# 夸克网盘 — 使用
|
||||
|
||||
## 目录浏览
|
||||
|
||||
```bash
|
||||
# 根目录
|
||||
mcporter call 'netdisk.list(cloud: "quark", path: "/")'
|
||||
|
||||
# 子目录
|
||||
mcporter call 'netdisk.list(cloud: "quark", path: "/动漫")'
|
||||
mcporter call 'netdisk.list(cloud: "quark", path: "/动漫/国漫2024")'
|
||||
```
|
||||
|
||||
列表输出中包含每项的 `(ID: xxx)`,即 FID(文件夹/文件唯一标识),后续操作需要用到。
|
||||
|
||||
## 查看分享链接
|
||||
|
||||
```bash
|
||||
# 查看完整内容
|
||||
mcporter call 'netdisk.view(share_link: "https://pan.quark.cn/s/xxx")'
|
||||
|
||||
# 按格式过滤
|
||||
mcporter call 'netdisk.view(share_link: "https://pan.quark.cn/s/xxx", file_pattern: "*.mp4")'
|
||||
mcporter call 'netdisk.view(share_link: "https://pan.quark.cn/s/xxx", file_pattern: "*.mkv")'
|
||||
```
|
||||
|
||||
## 转存文件
|
||||
|
||||
### 第一步:确认目标目录存在
|
||||
|
||||
```bash
|
||||
mcporter call 'netdisk.list(cloud: "quark", path: "/目标目录")'
|
||||
```
|
||||
|
||||
如果目录不存在,先创建(见下方"创建文件夹")。
|
||||
|
||||
### 第二步:转存
|
||||
|
||||
```bash
|
||||
# 转存分享中所有文件
|
||||
mcporter call 'netdisk.transfer(share_link: "https://pan.quark.cn/s/xxx", source_pattern: "/*", target_path: "/目标目录")'
|
||||
|
||||
# 按文件名匹配转存
|
||||
mcporter call 'netdisk.transfer(share_link: "https://pan.quark.cn/s/xxx", source_pattern: "/文件夹名/*.mp4", target_path: "/目标目录")'
|
||||
```
|
||||
|
||||
### 第三步:验证
|
||||
|
||||
```bash
|
||||
mcporter call 'netdisk.list(cloud: "quark", path: "/目标目录")'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Quark API 补全操作
|
||||
|
||||
以下操作 MCP 工具不支持,通过直接调用 Quark API 实现。
|
||||
|
||||
### 通用准备
|
||||
|
||||
```bash
|
||||
# 从文件读取避免泄露(推荐)
|
||||
COOKIE=$(cat cookie/quark.txt)
|
||||
|
||||
# 或直接写入(注意命令行历史)
|
||||
# COOKIE="你的夸克Cookie"
|
||||
```
|
||||
|
||||
### 获取 FID
|
||||
|
||||
方式一:从 `netdisk.list` 输出中提取
|
||||
```
|
||||
3. [dir] 遮.天(2023) (ID: 1ffc622be174429fa36de460856cad05)
|
||||
```
|
||||
|
||||
方式二:API 递归查询
|
||||
|
||||
```bash
|
||||
# 列出指定目录下的内容(含 FID)
|
||||
curl -s "https://drive-h.quark.cn/1/clouddrive/file/sort?pr=ucpro&fr=pc&pdir_fid=<父FID>&_page=1&_size=200" \
|
||||
-H "cookie: $COOKIE" | python -X utf8 -c "
|
||||
import json,sys
|
||||
data=json.load(sys.stdin)
|
||||
for item in data.get('data',{}).get('list',[]):
|
||||
t='📁' if item.get('file_type')==0 else '📄'
|
||||
print(f'{t} {item[\"file_name\"]} -> FID: {item[\"fid\"]}')
|
||||
"
|
||||
```
|
||||
|
||||
### 创建文件夹
|
||||
|
||||
```bash
|
||||
curl -s -X POST "https://drive-h.quark.cn/1/clouddrive/file?pr=ucpro&fr=pc&__t=$(date +%s)000" \
|
||||
-H "cookie: $COOKIE" \
|
||||
-H "content-type: application/json" \
|
||||
-H "origin: https://pan.quark.cn" \
|
||||
-H "referer: https://pan.quark.cn/" \
|
||||
-d '{"pdir_fid":"<父FID>","file_name":"<文件夹名>","file_type":0,"dir_init":true}'
|
||||
```
|
||||
|
||||
- `pdir_fid`:父目录 FID(根目录为 `0`)
|
||||
- 返回 `data.fid` 即新文件夹的 FID
|
||||
|
||||
### 移动文件
|
||||
|
||||
```bash
|
||||
curl -s -X POST "https://drive-h.quark.cn/1/clouddrive/file/move?pr=ucpro&fr=pc&__t=$(date +%s)000" \
|
||||
-H "cookie: $COOKIE" \
|
||||
-H "content-type: application/json" \
|
||||
-H "origin: https://pan.quark.cn" \
|
||||
-H "referer: https://pan.quark.cn/" \
|
||||
-d '{"action_type":1,"filelist":["<FID1>","<FID2>"],"to_pdir_fid":"<目标FID>"}'
|
||||
```
|
||||
|
||||
- `filelist` 建议 ≤30 个 FID 一批
|
||||
- 返回 `data.finish: true` 表示完成
|
||||
|
||||
### 删除文件
|
||||
|
||||
```bash
|
||||
curl -s -X POST "https://drive-h.quark.cn/1/clouddrive/file/delete?pr=ucpro&fr=pc&__t=$(date +%s)000" \
|
||||
-H "cookie: $COOKIE" \
|
||||
-H "content-type: application/json" \
|
||||
-H "origin: https://pan.quark.cn" \
|
||||
-H "referer: https://pan.quark.cn/" \
|
||||
-d '{"action_type":2,"filelist":["<FID1>","<FID2>"]}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 文件整理流程
|
||||
|
||||
### 场景:按集数分段归类
|
||||
|
||||
```bash
|
||||
# 1. 列出目标目录,获取所有文件 FID
|
||||
mcporter call 'netdisk.list(cloud: "quark", path: "/要整理的目录")'
|
||||
|
||||
# 2. 创建分段子目录
|
||||
for name in "101-120" "121-140" "141-150"; do
|
||||
curl -s -X POST "https://drive-h.quark.cn/1/clouddrive/file?pr=ucpro&fr=pc" \
|
||||
-H "cookie: $COOKIE" -H "content-type: application/json" \
|
||||
-H "origin: https://pan.quark.cn" -H "referer: https://pan.quark.cn/" \
|
||||
-d "{\"pdir_fid\":\"<父FID>\",\"file_name\":\"$name\",\"file_type\":0,\"dir_init\":true}"
|
||||
done
|
||||
|
||||
# 3. 移动文件到对应子目录
|
||||
curl -s -X POST "https://drive-h.quark.cn/1/clouddrive/file/move?pr=ucpro&fr=pc" \
|
||||
-H "cookie: $COOKIE" -H "content-type: application/json" \
|
||||
-H "origin: https://pan.quark.cn" -H "referer: https://pan.quark.cn/" \
|
||||
-d '{"action_type":1,"filelist":["<FID1>","<FID2>",...],"to_pdir_fid":"<目标子目录FID>"}'
|
||||
|
||||
# 4. 验证
|
||||
mcporter call 'netdisk.list(cloud: "quark", path: "/要整理的目录")'
|
||||
mcporter call 'netdisk.list(cloud: "quark", path: "/要整理的目录/101-120")'
|
||||
```
|
||||
|
||||
### 场景:转存后清理杂文件
|
||||
|
||||
转存的 `source_pattern` 匹配是**跨文件夹全局匹配**的,会混入不相关的文件。
|
||||
|
||||
```bash
|
||||
# 1. 转存
|
||||
mcporter call 'netdisk.transfer(...)'
|
||||
|
||||
# 2. 列出目标目录,找到杂文件
|
||||
mcporter call 'netdisk.list(cloud: "quark", path: "/目标目录")'
|
||||
|
||||
# 3. 获取杂文件的 FID,删除
|
||||
curl -s -X POST "https://drive-h.quark.cn/1/clouddrive/file/delete?pr=ucpro&fr=pc" \
|
||||
-H "cookie: $COOKIE" -H "content-type: application/json" \
|
||||
-H "origin: https://pan.quark.cn" -H "referer: https://pan.quark.cn/" \
|
||||
-d '{"action_type":2,"filelist":["<杂文件FID1>","<杂文件FID2>"]}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 调用语法注意事项
|
||||
|
||||
**必须使用函数式语法**,`key=value` 形式会报路径错误:
|
||||
|
||||
```bash
|
||||
# ✅ 正确
|
||||
mcporter call 'netdisk.list(cloud: "quark", path: "/")'
|
||||
|
||||
# ❌ 错误
|
||||
mcporter call netdisk.list cloud=quark path=/
|
||||
```
|
||||
Reference in New Issue
Block a user