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:
2026-05-16 18:28:23 +08:00
commit 750f981c7e
37 changed files with 7847 additions and 0 deletions
@@ -0,0 +1,73 @@
# 工作流:搜索 → 夸克网盘
通过 `netdisk.search` 跨平台搜索资源,找到分享链接后转存到夸克网盘。
## 步骤
### Step 1: 搜索资源
```bash
# 基本搜索
mcporter call 'netdisk.search(query: "流浪地球 4K")'
# 指定平台(夸克+磁力)
mcporter call 'netdisk.search(query: "流浪地球", cloud_types: ["quark", "magnet"])'
# 高级搜索:包含/排除关键词
mcporter call 'netdisk.search(query: "电视剧", include: ["合集"], exclude: ["预告"])'
```
支持的 `cloud_types`
| 类型 | 平台 |
|------|------|
| `quark` | 夸克网盘 |
| `baidu` | 百度网盘 |
| `aliyun` | 阿里云盘 |
| `115` | 115网盘 |
| `xunlei` | 迅雷网盘 |
| `magnet` | 磁力链接 |
| `pikpak` | PikPak |
### Step 2: 查看分享链接
用户选择结果中的一条链接后:
```bash
mcporter call 'netdisk.view(share_link: "https://pan.quark.cn/s/xxx")'
```
确认文件内容、大小是否符合预期。
### Step 3: 创建/确认目标目录
```bash
mcporter call 'netdisk.list(cloud: "quark", path: "/")'
```
如果目标目录不存在,参考 `references/quark-api.md` 创建。
### Step 4: 转存
```bash
mcporter call 'netdisk.transfer(share_link: "https://pan.quark.cn/s/xxx", source_pattern: "/*", target_path: "/目标路径")'
```
### Step 5: 验证
```bash
mcporter call 'netdisk.list(cloud: "quark", path: "/目标路径")'
```
如有杂文件用 Quark API 删除。
## 典型场景:找电影
```
1. search("奥本海默 4K", cloud_types=["quark"])
2. 用户选择一条结果
3. view() 确认是否为目标电影
4. 创建 /电影/2024 目录(如不存在)
5. transfer 到该目录
6. 验证
```
@@ -0,0 +1,148 @@
# 工作流:腾讯文档 → 夸克网盘
从腾讯文档(如 Tacit0924 的资源分享文档)中搜索关键词找到分享链接,转存到夸克网盘。
## 步骤
### Step 1: 读取腾讯文档内容
从 URL 中提取 `file_id``/doc/<file_id>` 部分):
```bash
# 获取文档结构
mcporter call tencent-docs doc.resolve_document_structure file_id=<FILE_ID> > doc_raw.json
# 提取文本内容到本地文件
python -X utf8 -c "
import json
with open('doc_raw.json','r',encoding='utf-8') as f:
data=json.load(f)
texts=[]
for n in data.get('nodes',[]):
p=n.get('text_preview','')
hl=n.get('heading_level',0)
if p:
texts.append(('#'*hl+' '+p) if hl>0 else p)
with open('doc_content.txt','w',encoding='utf-8') as f:
f.write('\n'.join(texts))
print(f'{len(texts)} paragraphs extracted')
"
# 清理中间文件(可选)
rm doc_raw.json
```
> **注意**:文档是 tencentdoc 类型用以上方法,smartcanvas 类型用 `smartcanvas.read`。
### Step 2: 搜索关键词匹配链接
```bash
# 在提取的文本中搜索关键词,找到分享链接
grep -n "关键词" doc_content.txt
# 或
python -X utf8 -c "
with open('doc_content.txt','r',encoding='utf-8') as f:
lines=f.readlines()
kw='关键词'
for i,line in enumerate(lines):
if kw in line:
# 打印上下文:前后3行
start=max(0,i-3)
end=min(len(lines),i+4)
print(f'--- Line {i+1} ---')
for j in range(start,end):
marker='>' if j==i else ' '
print(f'{marker} {lines[j].strip()[:150]}')
"
```
夸克链接格式:`https://pan.quark.cn/s/<id>`
### Step 3: 查看分享链接内容
```bash
mcporter call 'netdisk.view(share_link: "https://pan.quark.cn/s/xxx")'
```
可选:用 `file_pattern` 过滤特定格式:
```bash
mcporter call 'netdisk.view(share_link: "https://pan.quark.cn/s/xxx", file_pattern: "*.mp4")'
```
### Step 4: 确定/创建目标目录
先看看夸克网盘上是否已有该资源的目录:
```bash
mcporter call 'netdisk.list(cloud: "quark", path: "/动漫")'
```
如果已存在则复用,否则创建新目录:
```bash
# 创建目录需要父文件夹 FID,先获取
# 方式1:从 netdisk.list 输出中提取 (ID: xxx)
# 方式2:直接调用 API
# 创建子目录
COOKIE="你的夸克Cookie"
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":"<新目录名>","file_type":0,"dir_init":true}'
```
> API 详情见 `references/quark-api.md`
### Step 5: 转存
```bash
mcporter call 'netdisk.transfer(share_link: "https://pan.quark.cn/s/xxx", source_pattern: "/*", target_path: "/目标路径")'
```
> **注意**`source_pattern` 的 glob 跨所有文件夹匹配,转存后需要验证并清理。
### Step 6: 验证并清理
```bash
# 列出目标目录
mcporter call 'netdisk.list(cloud: "quark", path: "/目标路径")'
# 如果有混入的不相关文件,用 Quark API 删除
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>"]}'
```
### Step 7: 输出结果摘要
列出最终目录结构,让用户确认。
## 完整示例(遮天动画版)
参见 `resource-pipeline/SKILL.md` 的实际对话记录,关键节点:
```
输入: 腾讯文档 URL DR2xUcFdrSVhJTkZu + 关键词 "遮天"
1. doc.resolve_document_structure → 提取全文(853231字/28449段)
2. grep "遮天" → 找到链接 https://pan.quark.cn/s/0762b0d500f3
3. netdisk.view → 205文件/191GB,含1-162集4K
4. 发现已有目录 /动漫/国漫2024/遮.天(2023
→ 创建子目录 151-162
5. netdisk.transfer × 2 → 转存151-162集
6. Quark API delete → 清理混入的杂文件(Z 4K 15/16等)
结果: 遮.天(2023/151-162/ 含11集新内容
```
## 注意事项
- **get_content 大文档超时**:改用 `doc.resolve_document_structure`
- **目录必须存在**:转存前先用 API 创建不存在的目录
- **glob 跨文件夹**:验证后再清理杂文件
- **Windows 编码**:用 `python -X utf8` 处理 emoji
@@ -0,0 +1,88 @@
# 工作流:整理夸克网盘文件
对夸克网盘中已有的文件按规则分段整理归档。
## 步骤
### Step 1: 列出目标目录
```bash
mcporter call 'netdisk.list(cloud: "quark", path: "/要整理的目录")'
```
观察文件命名规律,确定分段方案。
### Step 2: 分析命名并确定分段规则
常见命名模式与分组建议:
| 文件命名示例 | 建议分段 | 说明 |
|-------------|---------|------|
| 第01集.mp4 ~ 第100集.mp4 | 01-30, 31-60, 61-90, 91-100 | 按30集一段 |
| E01.mp4 ~ E162.mp4 | 1-50, 51-100, 101-150, 151-162 | 按50集一段 |
| 遮天104 4K ~ 遮天162 4K | 101-120, 121-140, 141-150, 151-162 | 按20集一段 |
### Step 3: 创建分段文件夹
需要父目录的 FID(从 `netdisk.list` 输出的 `(ID: xxx)` 获取):
```bash
COOKIE="你的夸克Cookie"
# 批量创建目录
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
```
### Step 4: 移动文件到对应文件夹
按文件 FID 分组移动到各自的目标目录:
```bash
# 移动一批文件到目标目录
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>"}'
```
> 注意:`filelist` 每次建议不超过 30 个 FID。
### Step 5: 验证最终结构
```bash
# 查看根目录(只剩子文件夹)
mcporter call 'netdisk.list(cloud: "quark", path: "/要整理的目录")'
# 抽查子目录内容
mcporter call 'netdisk.list(cloud: "quark", path: "/要整理的目录/101-120")'
```
## 完整示例(遮天整理)
```
整理前:遮.天(2023)/ ← 37个文件平铺(104-150集)
├── 104 4K.mp4
├── 108 4K.mp4
├── ...(37个文件散落)
整理后:遮.天(2023/
├── 101-120/ ← 104, 108, 109, 117-1207集)
├── 121-140/ ← 121-14020集)
├── 141-150/ ← 141-15010集)
└── 151-162/ ← 151-16211集,后续新增)
```
## 注意事项
- **FID 总在变**:每次列出目录时都要重新获取 FID,不要硬编码
- **移动是异步的**API 返回 `finish: true` 才能确认完成
- **先创建再移动**:文件夹不存在时 move 会失败