browser-auto-download
Latest: v1.0.6
Redirect-chain response check (off-site hop closes page and fails run), explicit file_write/network declarations in permissions and allowed-tools, docs aligned with the three enforcement layers.
Browser Auto Download v1.0.6
Automate file downloads from dynamic pages with Playwright. The browser follows page-provided navigation and clicks, then saves the resulting file to disk.
Safety notice (read before running)
- Downloads are untrusted input. The tool saves files the page hands it. It does not code-sign, sandbox, or scan them. Verify the publisher's signature or a checksum before opening or installing anything.
- The page can steer the browser. Automatic navigation and clicking may trigger unintended or deceptive downloads. Keep to sites you trust, and review the printed target URLs.
- Files are written to disk. The default destination is
~/Downloads/browser-auto-download. Pass--outputto isolate a run further. - Executables are gated. Saving
.exe,.msi,.dmg,.pkg,.appimage,.deb,.rpm, or script files requires--sha256 <digest>or an explicit--acknowledge-executable. - Debug mode captures page data.
--debugwrites screenshots, HTML, and text that may include credentials, personal data, or internal URLs. Redaction is best effort. Review and delete the debug folder when done.
Capabilities and scope
- Network: outbound HTTP/HTTPS to the exact starting host, unless
--allow-hostor--allow-external-hostsis passed. - Filesystem: writes downloads and optional debug artifacts to the directory the
user selects (default
~/Downloads/browser-auto-download); reads page content only through the browser session. - Browser: launches Chromium via Playwright; no persistent profile is reused.
- Credentials: the skill does not read, store, or request Discord/API tokens.
When to use
- Downloads start automatically on page load.
- The download link only exists after multi-step navigation (homepage → PC page).
- Links are generated by JavaScript, or require clicking a button.
- Platform-specific installers need to be selected automatically.
- A direct installer URL only works inside a browser session (cookies, redirect
chain, or client-side gating) and cannot be fetched by
curl/wget.
When not to use
- Plain static files that
curl/wgetcan fetch and verify — use those tools. - Scraping page content, crawling, or archiving sites.
- Authenticated, private, or internal pages you are not authorized to automate.
- Untrusted sources, or when you cannot verify the resulting binary.
Install (pinned)
pip install -r requirements.txt
# pinned to playwright==1.65.0
playwright install chromium
The Playwright version also fixes the Chromium build that
playwright install chromium fetches. Bump the pin only after reviewing the
upstream changelog.
Usage
# Auto-detect mode
python skills/browser-auto-download/scripts/auto_download.py \
--url "https://example.com/download"
# Installer: verify a known digest, or acknowledge the risk explicitly
python skills/browser-auto-download/scripts/auto_download.py \
--url "https://example.com/download" \
--sha256 "<expected-sha256>"
python skills/browser-auto-download/scripts/auto_download.py \
--url "https://example.com/download" \
--acknowledge-executable
# Isolate output and cross to a CDN only when intended
python skills/browser-auto-download/scripts/auto_download.py \
--url "https://example.com/download" \
--output "/path/to/dedicated/folder" \
--allow-external-hosts
Built-in shortcuts
These use hard-coded, reviewed vendor URLs, but still require the executable flag because the saved file is unverified:
python skills/browser-auto-download/scripts/auto_download.py --wechat --acknowledge-executable
python skills/browser-auto-download/scripts/auto_download.py --meitu --acknowledge-executable
python skills/browser-auto-download/scripts/auto_download.py --golang --acknowledge-executable
python skills/browser-auto-download/scripts/auto_download.py --eclipse --acknowledge-executable
The --meitu preset already allows its own platform host (pc.meitu.com). For
any other cross-host flow, pass --allow-host <host> explicitly.
Python API
from skills.browser_auto_download.scripts.auto_download import auto_download
result = auto_download(
url="https://example.com/download",
output_dir="/path/to/dedicated/folder",
auto_select=True,
auto_navigate=True,
expected_sha256=None, # pass a digest to verify
acknowledge_executable=False # required for installers when no digest
)
if result:
print(result["path"], result["sha256"])
Options
| Flag | Effect |
|---|---|
--output <dir> | Output directory (default ~/Downloads/browser-auto-download) |
--sha256 <digest> | Verify the saved file; mismatch deletes it |
--acknowledge-executable | Allow saving installers without a digest |
--allow-external-hosts | Permit navigation outside the starting host |
--allow-host <host> | Add one extra allowed host (repeatable) |
--debug | Save screenshot/HTML/text (sensitive; see Safety notice) |
--headless | Run without a visible browser window |
--no-auto-select | Disable platform detection |
--no-auto-navigate | Disable multi-step navigation |
--selector <css> | Use an explicit download button selector |
How it works
- Open the page and capture any download event.
- If nothing fires, follow a same-host platform link and re-check.
- Otherwise score visible links/buttons, then click or navigate in order.
- Save the download under a sanitized filename confined to the output directory, compute SHA-256, and report it.
Page-supplied candidate URLs are rejected when they leave the starting host
(unless --allow-host / --allow-external-hosts is passed). Enforcement has
three layers:
- Browser-level request filter — off-site document requests are aborted before they load, so a link click cannot start the navigation.
- Redirect check — the resolved response URL is checked too; an off-site redirect hop closes the page and fails the run.
- Download host check — a download whose final URL is off-site is deleted and refused.
Page-supplied filenames are reduced to a safe basename, so names like ../../x
cannot escape the output directory.
Platform detection
| System | Architecture | Keywords |
|---|---|---|
| Windows | AMD64/x86_64 | windows, win64, x64, 64-bit, pc |
| Windows | x86/i686 | windows, win32, x86, 32-bit, pc |
| macOS | ARM64 (M1/M2/M3) | macos, arm64, apple silicon |
| macOS | x86_64 (Intel) | macos, x64, intel |
| Linux | x86_64 | linux, x64, amd64 |
Output
stdout is a JSON object:
{
"path": "C:\\Users\\User\\Downloads\\browser-auto-download\\setup.exe",
"filename": "setup.exe",
"size_bytes": 243209941,
"size_mb": 231.9,
"sha256": "9f2c…",
"platform": "Windows AMD64"
}
Progress and warnings go to stderr.
Troubleshooting
- No download: run without
--headlessto watch the page; check stderr for blocked or skipped targets; pass--selector. - Wrong version: inspect the platform line in stderr; disable
--no-auto-selector use--selector. - Navigation blocked: the link left the starting host. Confirm it is
legitimate before adding
--allow-external-hosts. - Executable refused: supply
--sha256(preferred) or--acknowledge-executable. - Debug artifacts: stored under
<output>/browser-auto-download-debug/; delete them after review.
Language
Reply in the user's language. The bundled docs are English and Chinese; do not force a single language on the user.
