quark-download
npx skills add https://github.com/psylch/quark-download-skill --skill quark-download
Agent 安装分布
Skill 文档
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 ${SKILL_PATH}/scripts/quark_search.py. It outputs JSON to stdout ({"ok": true, "data": {...}} or {"ok": false, "error": "...", "code": "..."}) and logs progress to stderr.
Prerequisites Check
Before any operation, verify the environment:
python3 ${SKILL_PATH}/scripts/quark_search.py check
Response: {"ok": true, "data": {"isLogin": true, ...}} â confirms APP is running and logged in.
If the command fails with "code": "app_not_running", instruct the user to launch Quark APP. If isLogin is false, instruct the user to log in first.
Workflow â Quick Search (recommended)
A single command searches PanSou, validates all links in parallel, and fetches file details for the top results:
python3 ${SKILL_PATH}/scripts/quark_search.py search "KEYWORD" --top 5
Options:
| Flag | Default | Description |
|---|---|---|
--top N |
5 |
Number of top valid results to return with details |
--no-validate |
off | Skip validation (faster, but may include dead links) |
--limit N |
30 |
PanSou results per page |
--page N |
1 |
PanSou page number |
Success response (ok: true):
{
"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â total results across all drive types from PanSouvalid_countâ how many quark links passed validationresults[].pwd_idâ share ID for save commandresults[].detail.list[]â files/folders in the shareresults[].detail.list[].dirâtrueif folder (more reliable than file_type)results[].detail.list[].fidâ use withdetailcommand to browse subfolders
No quark results: When results is empty but total > 0, the response includes type_counts showing available results on other drive types. Report these to the user.
Priority: Always prioritize quark type results since the user has Quark membership. The script handles this automatically.
Workflow â Step-by-step
For granular control, use individual subcommands:
Validate Links
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:
status |
Meaning | Action |
|---|---|---|
valid |
Share is alive | Proceed. Response includes stoken for detail query |
expired |
Share expired (code 41004) | Skip, mark as expired |
not_exist |
Share deleted (code 41006) | Skip, mark as invalid |
error |
Other error | Skip |
Get File Details
python3 ${SKILL_PATH}/scripts/quark_search.py detail PWD_ID --stoken STOKEN [--fid FID]
Fetches the file listing for a share. Use --fid to browse into a subfolder (pass the folder’s fid from a previous detail response).
Health Check
python3 ${SKILL_PATH}/scripts/quark_search.py health [--refresh]
Shows PanSou API status and the channels/plugins lists used for search. Health data is cached for 24 hours at ~/.cache/quark-search/health.json. Use --refresh to force a fresh fetch.
Present 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.
Save
When the user selects a resource, trigger the Quark APP to open the share link:
python3 ${SKILL_PATH}/scripts/quark_search.py save PWD_ID_OR_URL
The script tries three methods in order: desktop_share_visiting (preferred) â desktop_caller deeplink â browser fallback. The response indicates which method succeeded.
After a successful APP save (method desktop_share_visiting or desktop_caller), inform the user:
å·²å¨å¤¸å APP 䏿å¼åäº«é¾æ¥çªå£ã注æï¼å¼¹åºççªå£å¯è½å¾å°ï¼è¯·çæä»»å¡æ /Dock ä¸ç夸å 徿 ã å¨ APP ä¸ç¹å»ãä¿åå°ç½çãæé®å®æä¿åãä¿ååæä»¶ä¼åºç°å¨ä½ çç½çä¸ï¼å¯ä»¥ç´æ¥å¨ APP ä¸ä¸è½½å°æ¬å°ã
If the response method is browser_fallback, open the URL in the browser instead and inform the user to save from the web page.
Batch 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 search command, then trigger APP saves sequentially.
Error Handling
| Error | Detection | Resolution |
|---|---|---|
| Quark APP not running | check returns code: "app_not_running" |
Tell user to launch Quark APP |
| Not logged in | check returns isLogin: false |
Tell user to log in |
| No search results | search returns total: 0 |
Suggest different keywords |
| All links invalid | search returns valid_count: 0 |
Try alternative keywords or drive types |
| Share has password | validate returns password required error |
Ask user for the extraction code (æåç ) |
| PanSou API error | search returns code: "pansou_error" |
Retry or try later |
Important Notes
- All share validation APIs are public (no authentication needed)
- The local Quark APP API at
localhost:9128requires no authentication - 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