quark-download
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseQuark Search — 网盘资源搜索与下载
Quark Search — 网盘资源搜索与下载
Automate the full workflow: search resources → validate links → save to Quark cloud drive → download locally, by combining the PanSou aggregation API with the local Quark desktop APP.
All operations use the CLI script at . It outputs JSON to stdout ( or ) and logs progress to stderr.
${SKILL_PATH}/scripts/quark_search.py{"ok": true, "data": {...}}{"ok": false, "error": "...", "code": "..."}结合PanSou聚合API与本地Quark桌面APP,实现全工作流自动化:搜索资源→验证链接→保存到Quark网盘→本地下载。
所有操作均使用路径下的CLI脚本。它会向标准输出(stdout)返回JSON(格式为 或 ),并将进度日志输出到标准错误(stderr)。
${SKILL_PATH}/scripts/quark_search.py{"ok": true, "data": {...}}{"ok": false, "error": "...", "code": "..."}Prerequisites Check
前置检查
Before any operation, verify the environment:
bash
python3 ${SKILL_PATH}/scripts/quark_search.py checkResponse: — confirms APP is running and logged in.
{"ok": true, "data": {"isLogin": true, ...}}If the command fails with , instruct the user to launch Quark APP. If is , instruct the user to log in first.
"code": "app_not_running"isLoginfalse执行任何操作前,先验证环境是否正常:
bash
python3 ${SKILL_PATH}/scripts/quark_search.py check响应: — 确认APP正在运行且已登录。
{"ok": true, "data": {"isLogin": true, ...}}如果命令执行失败,返回,请提示用户启动Quark APP。如果为,请提示用户先登录账号。
"code": "app_not_running"isLoginfalseWorkflow — Quick Search (recommended)
工作流 — 快速搜索(推荐)
A single command searches PanSou, validates all links in parallel, and fetches file details for the top results:
bash
python3 ${SKILL_PATH}/scripts/quark_search.py search "KEYWORD" --top 5Options:
| Flag | Default | Description |
|---|---|---|
| | Number of top valid results to return with details |
| off | Skip validation (faster, but may include dead links) |
| | PanSou results per page |
| | PanSou page number |
Success response ():
ok: truejson
{
"ok": true,
"data": {
"keyword": "三体",
"total": 1234,
"valid_count": 8,
"results": [
{
"pwd_id": "abc123def",
"url": "https://pan.quark.cn/s/abc123def",
"note": "三体全集 4K",
"source": "plugin:libvio",
"datetime": "2025-01-15",
"stoken": "xxx",
"detail": {
"pwd_id": "abc123def",
"pdir_fid": "0",
"total": 3,
"list": [
{"file_name": "三体S01E01.mkv", "size": 4294967296, "dir": false, "fid": "f1"},
{"file_name": "Extras", "size": 0, "dir": true, "fid": "f2", "include_items": 5}
]
}
}
]
}
}Key fields:
- — total results across all drive types from PanSou
total - — how many quark links passed validation
valid_count - — share ID for save command
results[].pwd_id - — files/folders in the share
results[].detail.list[] - —
results[].detail.list[].dirif folder (more reliable than file_type)true - — use with
results[].detail.list[].fidcommand to browse subfoldersdetail
No quark results: When is empty but > 0, the response includes showing available results on other drive types. Report these to the user.
resultstotaltype_countsPriority: Always prioritize type results since the user has Quark membership. The script handles this automatically.
quark单条命令即可完成PanSou搜索、并行验证所有链接、获取 top 结果的文件详情:
bash
python3 ${SKILL_PATH}/scripts/quark_search.py search "KEYWORD" --top 5可选参数:
| Flag | 默认值 | 描述 |
|---|---|---|
| | 返回带详情的有效结果数量上限 |
| 关闭 | 跳过链接验证(速度更快,但可能包含死链) |
| | 单页返回的PanSou结果数量 |
| | PanSou搜索页码 |
成功响应():
ok: truejson
{
"ok": true,
"data": {
"keyword": "三体",
"total": 1234,
"valid_count": 8,
"results": [
{
"pwd_id": "abc123def",
"url": "https://pan.quark.cn/s/abc123def",
"note": "三体全集 4K",
"source": "plugin:libvio",
"datetime": "2025-01-15",
"stoken": "xxx",
"detail": {
"pwd_id": "abc123def",
"pdir_fid": "0",
"total": 3,
"list": [
{"file_name": "三体S01E01.mkv", "size": 4294967296, "dir": false, "fid": "f1"},
{"file_name": "Extras", "size": 0, "dir": true, "fid": "f2", "include_items": 5}
]
}
}
]
}
}关键字段说明:
- — PanSou返回的所有类型网盘的总结果数
total - — 通过验证的Quark链接数量
valid_count - — 保存命令所需的分享ID
results[].pwd_id - — 分享链接内的文件/文件夹列表
results[].detail.list[] - — 为
results[].detail.list[].dir时表示是文件夹(比file_type更可靠)true - — 可传入
results[].detail.list[].fid命令浏览子文件夹detail
无Quark结果: 如果为空但>0,响应会包含字段,展示其他类型网盘的可用结果数量,请将该信息告知用户。
resultstotaltype_counts优先级: 由于用户拥有Quark会员,请始终优先返回类型的结果,脚本已自动处理该逻辑。
quarkWorkflow — Step-by-step
工作流 — 分步执行
For granular control, use individual subcommands:
如需更精细的控制,可使用独立子命令:
Validate Links
验证链接
bash
python3 ${SKILL_PATH}/scripts/quark_search.py validate PWD_ID_OR_URL [...]Accepts multiple pwd_ids or full share URLs. Returns validation status for each:
| Meaning | Action |
|---|---|---|
| Share is alive | Proceed. Response includes |
| Share expired (code 41004) | Skip, mark as expired |
| Share deleted (code 41006) | Skip, mark as invalid |
| Other error | Skip |
bash
python3 ${SKILL_PATH}/scripts/quark_search.py validate PWD_ID_OR_URL [...]支持传入多个pwd_id或完整分享链接,返回每个链接的验证状态:
| 含义 | 后续操作 |
|---|---|---|
| 分享链接有效 | 可继续操作,响应包含详情查询所需的 |
| 分享已过期(错误码41004) | 跳过,标记为过期 |
| 分享已被删除(错误码41006) | 跳过,标记为无效 |
| 其他错误 | 跳过 |
Get File Details
获取文件详情
bash
python3 ${SKILL_PATH}/scripts/quark_search.py detail PWD_ID --stoken STOKEN [--fid FID]Fetches the file listing for a share. Use to browse into a subfolder (pass the folder's from a previous detail response).
--fidfidbash
python3 ${SKILL_PATH}/scripts/quark_search.py detail PWD_ID --stoken STOKEN [--fid FID]获取分享链接的文件列表。如需浏览子文件夹,可传入参数(值为上一次详情响应中对应文件夹的)。
--fidfidHealth Check
健康检查
bash
python3 ${SKILL_PATH}/scripts/quark_search.py health [--refresh]Shows PanSou API status and the / lists used for search. Health data is cached for 24 hours at . Use to force a fresh fetch.
channelsplugins~/.cache/quark-search/health.json--refreshbash
python3 ${SKILL_PATH}/scripts/quark_search.py health [--refresh]展示PanSou API状态以及搜索使用的/列表。健康数据会缓存24小时,存储路径为。使用参数可强制拉取最新数据。
channelsplugins~/.cache/quark-search/health.json--refreshPresent Results to User
向用户展示结果
Format results clearly:
搜索 "三体" 找到 X 个有效夸克网盘资源:
1. [有效] 三体全集 4K — 3个文件,来源: plugin:libvio
https://pan.quark.cn/s/abc123
2. [有效] 三体 第一季 1080P — 1个文件夹(42项),来源: channel:yunpanx
https://pan.quark.cn/s/def456
3. [已失效] 三体合集 — 分享已过期Ask the user which one to save.
请清晰格式化搜索结果:
搜索 "三体" 找到 X 个有效夸克网盘资源:
1. [有效] 三体全集 4K — 3个文件,来源: plugin:libvio
https://pan.quark.cn/s/abc123
2. [有效] 三体 第一季 1080P — 1个文件夹(42项),来源: channel:yunpanx
https://pan.quark.cn/s/def456
3. [已失效] 三体合集 — 分享已过期询问用户想要保存哪个资源。
Save
保存资源
When the user selects a resource, trigger the Quark APP to open the share link:
bash
python3 ${SKILL_PATH}/scripts/quark_search.py save PWD_ID_OR_URLThe script tries three methods in order: (preferred) → deeplink → browser fallback. The response indicates which method succeeded.
desktop_share_visitingdesktop_callerAfter a successful APP save (method or ), inform the user:
desktop_share_visitingdesktop_caller已在夸克 APP 中打开分享链接窗口。注意:弹出的窗口可能很小,请留意任务栏/Dock 上的夸克图标。 在 APP 中点击「保存到网盘」按钮完成保存。保存后文件会出现在你的网盘中,可以直接在 APP 中下载到本地。
If the response method is , open the URL in the browser instead and inform the user to save from the web page.
browser_fallback当用户选定资源后,触发Quark APP打开分享链接:
bash
python3 ${SKILL_PATH}/scripts/quark_search.py save PWD_ID_OR_URL脚本会按顺序尝试三种打开方式:(优先)→ 深度链接→浏览器兜底。响应会说明最终使用的成功方式。
desktop_share_visitingdesktop_caller如果通过或方式成功唤起APP保存,请告知用户:
desktop_share_visitingdesktop_caller已在夸克 APP 中打开分享链接窗口。注意:弹出的窗口可能很小,请留意任务栏/Dock 上的夸克图标。 在 APP 中点击「保存到网盘」按钮完成保存。保存后文件会出现在你的网盘中,可以直接在 APP 中下载到本地。
如果响应显示使用了方式,请在浏览器中打开对应URL,并告知用户从网页端完成保存。
browser_fallbackBatch Processing
批量处理
When the user wants to search and save multiple resources, loop through the search → present → save workflow for each keyword. Validate all links first via the command, then trigger APP saves sequentially.
search当用户需要搜索并保存多个资源时,可对每个关键词循环执行「搜索→展示结果→保存」的工作流。先通过命令验证所有链接,再依次触发APP保存操作。
searchError Handling
错误处理
| Error | Detection | Resolution |
|---|---|---|
| Quark APP not running | | Tell user to launch Quark APP |
| Not logged in | | Tell user to log in |
| No search results | | Suggest different keywords |
| All links invalid | | Try alternative keywords or drive types |
| Share has password | | Ask user for the extraction code (提取码) |
| PanSou API error | | Retry or try later |
| 错误类型 | 检测方式 | 解决方法 |
|---|---|---|
| Quark APP未运行 | | 告知用户启动Quark APP |
| 未登录账号 | | 告知用户先登录Quark账号 |
| 无搜索结果 | | 建议用户更换关键词 |
| 所有链接均无效 | | 建议用户更换关键词或尝试其他类型网盘 |
| 分享需要密码 | | 向用户索要提取码 |
| PanSou API错误 | | 建议重试或稍后再试 |
Important Notes
重要说明
- All share validation APIs are public (no authentication needed)
- The local Quark APP API at requires no authentication
localhost:9128 - The actual save-to-drive operation happens in the Quark APP UI (user clicks one button)
- Download-to-local is handled by Quark APP's built-in download manager
- Do not attempt to call Quark's authenticated remote APIs directly
- 所有分享链接验证API均为公开接口,无需认证
- 运行在的本地Quark APP API无需认证
localhost:9128 - 实际保存到网盘的操作在Quark APP UI中完成(用户只需点击一次按钮)
- 下载到本地的操作由Quark APP内置的下载管理器处理
- 请勿直接调用Quark的需认证远程API