Files
media-center/storage/quark/v1/usage.md
T
sutong 750f981c7e feat: init media-center skill
资源中心——从多渠道获取资源链接,转存到夸克网盘并整理归档。
- sources/tencent-doc: 腾讯文档读取
- sources/search: 网盘搜索
- storage/quark: 夸克网盘操作
- ref/: 来源 skill 参考归档

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-16 18:28:23 +08:00

5.4 KiB
Raw Blame History

夸克网盘 — 使用

目录浏览

# 根目录
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(文件夹/文件唯一标识),后续操作需要用到。

查看分享链接

# 查看完整内容
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")'

转存文件

第一步:确认目标目录存在

mcporter call 'netdisk.list(cloud: "quark", path: "/目标目录")'

如果目录不存在,先创建(见下方"创建文件夹")。

第二步:转存

# 转存分享中所有文件
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: "/目标目录")'

第三步:验证

mcporter call 'netdisk.list(cloud: "quark", path: "/目标目录")'

Quark API 补全操作

以下操作 MCP 工具不支持,通过直接调用 Quark API 实现。

通用准备

# 从文件读取避免泄露(推荐)
COOKIE=$(cat cookie/quark.txt)

# 或直接写入(注意命令行历史)
# COOKIE="你的夸克Cookie"

获取 FID

方式一:从 netdisk.list 输出中提取

3. [dir] 遮.天(2023 (ID: 1ffc622be174429fa36de460856cad05)

方式二:API 递归查询

# 列出指定目录下的内容(含 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\"]}')
"

创建文件夹

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

移动文件

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 表示完成

删除文件

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>"]}'

文件整理流程

场景:按集数分段归类

# 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 匹配是跨文件夹全局匹配的,会混入不相关的文件。

# 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 形式会报路径错误:

# ✅ 正确
mcporter call 'netdisk.list(cloud: "quark", path: "/")'

# ❌ 错误
mcporter call netdisk.list cloud=quark path=/