quark-search
npx skills add https://github.com/psylch/quark-search --skill quark-search
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.
Prerequisites Check
Before any operation, verify the environment:
# Check Quark APP status and login
curl -s "http://localhost:9128/desktop_info" | python3 -m json.tool
Expected: isLogin: true. If the APP is not running or not logged in, instruct the user to launch Quark and log in first.
Workflow
Step 1: Search Resources (PanSou API)
# Search with keyword, returns results grouped by cloud drive type
curl -s "https://s.panhunt.com/api/search?q=KEYWORD&page=1&limit=20"
Response structure:
{
"code": 0,
"data": {
"total": 1234,
"merged_by_type": {
"quark": [{"url": "https://pan.quark.cn/s/xxx", "note": "èµæºå", "source": "plugin:libvio", "datetime": "..."}],
"baidu": [...],
"aliyun": [...],
"115": [...],
"pikpak": [...],
"uc": [...]
}
}
}
Parameters:
| Param | Description | Example |
|---|---|---|
q |
Search keyword (required) | q=ä¸ä½ |
page |
Page number | page=1 |
limit |
Results per page | limit=20 |
type |
Filter by drive type | type=quark |
source |
Filter by source | source=plugin:libvio |
JSON parsing note: PanSou API responses may contain invalid escape sequences. Always parse with json.loads(raw, strict=False) in Python.
Priority: Always prioritize quark type results since the user has Quark membership. Fall back to aliyun, uc, baidu etc. if no quark results.
Step 2: Validate Links
Before presenting results to the user, validate each candidate link. Extract pwd_id from the share URL (https://pan.quark.cn/s/{pwd_id}), then:
# Get share token and check validity
curl -s -X POST "https://drive-pc.quark.cn/1/clouddrive/share/sharepage/token?pr=ucpro&fr=pc" \
-H "content-type: application/json" \
-d '{"pwd_id":"PWD_ID_HERE","passcode":""}'
Interpret response:
code |
Meaning | Action |
|---|---|---|
0 |
Valid share | Proceed. Extract stoken from response for detail query |
41006 |
Share does not exist (å享ä¸åå¨) | Skip, mark as invalid |
41004 |
Share expired (åäº«å·²è¿æ) | Skip, mark as expired |
| Other non-zero | Other error | Skip |
Step 3: Get File Details
For valid links, fetch the file list to show the user what’s inside:
curl -s "https://drive-pc.quark.cn/1/clouddrive/share/sharepage/detail?pr=ucpro&fr=pc&pwd_id=PWD_ID&stoken=STOKEN_URL_ENCODED&pdir_fid=0&force=0&_page=1&_size=50&_sort=file_type:asc,updated_at:desc" \
-H "user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36"
Extract from response:
data.list[].file_nameâ file/folder namedata.list[].sizeâ file size (bytes, 0 for folders)data.list[].include_itemsâ number of items in folderdata.list[].file_typeâ 0=folder, 1=filemetadata._totalâ total items in share
Step 4: 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.
Step 5: Trigger Quark APP Save
When the user selects a resource, trigger the Quark APP to open the share link:
# Method 1: via desktop_share_visiting (preferred, opens share view window)
curl -s "http://localhost:9128/desktop_share_visiting?pwd_id=PWD_ID_HERE"
# Method 2: via desktop_caller with deeplink (alternative)
curl -s "http://localhost:9128/desktop_caller?deeplink=qkclouddrive%3A%2F%2Fsave%3Furl%3Dhttps%253A%252F%252Fpan.quark.cn%252Fs%252FPWD_ID_HERE"
After triggering, inform the user:
å·²å¨å¤¸å APP 䏿å¼åäº«é¾æ¥çªå£ãè¯·å¨ APP ä¸ç¹å»ãä¿åå°ç½çãæé®å®æä¿åãä¿ååæä»¶ä¼åºç°å¨ä½ çç½çãæ¥èªï¼å享ãæä»¶å¤¹ä¸ï¼å¯ä»¥ç´æ¥å¨ APP ä¸ä¸è½½å°æ¬å°ã
Step 6: Batch Processing
When the user wants to search and save multiple resources, loop through steps 1-5 for each keyword. Validate all links first, then trigger APP saves sequentially with a brief delay between each.
Error Handling
| Error | Detection | Resolution |
|---|---|---|
| Quark APP not running | localhost:9128 connection refused |
Tell user to launch Quark APP |
| Not logged in | desktop_info returns isLogin: false |
Tell user to log in |
| No search results | PanSou returns total: 0 |
Suggest different keywords |
| All links invalid | All validation checks fail | Try alternative drive types or different keywords |
| Share has password | Token API returns password required error | Ask user for the extraction code (æåç ) |
Health Check Endpoint
To check PanSou API status and supported sources:
curl -s "https://s.panhunt.com/api/health"
Returns: channels_count (Telegram channels), plugin_count (website plugins), status.
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