| name | quark-hub |
| version | 1.4.0 |
| description | Quark cloud drive file management tool. Supports login, list directory, save shared links, download files, create directory. Login uses minis-browser-use instead of the original Playwright. Triggers when user mentions "Quark cloud drive", "Quark download", "Quark save", "quark", "pan.quark.cn". |
quark-hub
Minis version of Quark cloud drive tool, based on ihmily/QuarkPanTool (Apache-2.0).
File Paths
| File | Path | Description |
|---|
| Main script | /var/minis/skills/quark-hub/quark_hub.py | All command entry points |
| Share list script | /var/minis/skills/quark-hub/scripts/quark_share_ls.py | Standalone script, no login required |
| Cookie Refresh Script | /var/minis/skills/quark-hub/scripts/refresh_cookie.sh | One-click Cookie refresh |
| Cookie Cache | ~/.quark_hub_cookie | Login persistence, cross-session reuse, permission 600 |
Dependencies
Zero pip installation, only need Alpine native packages (iSH pre-installed):
| Package | Source | Purpose |
|---|
aiohttp | Alpine native (py3-aiohttp) | All async HTTP requests |
| Standard library | Python built-in | asyncio / json / re / urllib / threading etc. |
If aiohttp is unavailable:
apk add py3-aiohttp
Command Reference
| Command | Login | Description |
|---|
ls-share <url> | 🔓 No | List root directory files of shared link |
tree-share <url> | 🔓 No | Recursively expand full file tree of shared link |
info | 🔒 Required | View account info and capacity |
ls [fid] | 🔒 Required | List own cloud drive directory (with fid) |
save <url> [fid] | 🔒 Required | Save shared files to cloud drive (auto-check if exist) |
dl <url> [dir] | 🔒 Required | Download own cloud drive files to local (background thread + progress) |
mkdir <name> [fid] | 🔒 Required | Create cloud drive directory |
Best Practice for Save + Download (Agent Must Read)
When downloading files from others' shared links, follow this order to avoid duplicate saves:
1. tree-share <url> # See what's in the share
2. ls [to_fid] # Check if target directory already has content with same name
3a. Already exists -> Get fid and download # Skip save, use existing fid to call api_get_download_urls
3b. Not exist -> save <url> # Save (internally auto-checks, skips if exists)
4. ls [to_fid] # Get fid of saved files
5. dl (with extra_fids) # Background thread download, auto print progress and 1min avg speed
Key: save command now auto-checks if target directory already has files with same name, skips save if exists.
But agent should still ls before calling save to avoid unnecessary network requests.
Download Notes
dl / download_files_bg can only download files from your own cloud drive (Quark API limitation)
- Others' shares -> save first -> then ls to get fid -> then dl
- Download uses background thread, prints progress every 10 seconds (done/total/percentage/1min avg speed)
- Download URL points to Alibaba Cloud OSS, headers must not include Content-Type (already handled in code)
- Subtitle etc. files can be renamed via rename_map parameter during download (e.g. match video filename)
Code-level API (for script import)
from quark_hub import (
ensure_cookie,
api_get_download_urls,
download_files_bg,
api_list_all,
)
Login Flow (agent executes)
Script does not drive the browser. When script exits with exit code 10, it means login is needed.
Agent completes login by following these steps:
Step 1: Give user a clickable login link
Please login to Quark cloud drive: [Click to login Quark cloud drive](https://pan.quark.cn)
Tell me after login~
Step 2: After user confirms login, extract Cookie and save
sh /var/minis/skills/quark-hub/scripts/refresh_cookie.sh
Step 3: Verify login success
python3 /var/minis/skills/quark-hub/quark_hub.py info
Usage Examples
S=/var/minis/skills/quark-hub/quark_hub.py
python3 $S ls-share "https://pan.quark.cn/s/xxxxxxxx"
python3 $S tree-share "https://pan.quark.cn/s/xxxxxxxx"
python3 $S info
python3 $S ls
python3 $S ls <fid>
python3 $S save "https://pan.quark.cn/s/xxxxxxxx"
python3 $S save "https://pan.quark.cn/s/xxxxxxxx?pwd=1234" <target_fid>
python3 $S dl "https://pan.quark.cn/s/xxxxxxxx" /var/minis/workspace/
python3 $S mkdir My Movies
Notes
- Cookie valid for about 7-30 days, re-login when expired
- Strictly prohibited for illegal use, this tool only calls Quark official API