CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

HTTrack

$ httrack 社区开源 中风险
Xavier Roche · 浏览器与网页抓取 · GPL-3.0-or-later · macos / linux / windows

HTTrack(httrack)是一款经典的 C 语言离线浏览器,可将网站递归镜像为本地可浏览的 HTML 目录并自动重写离线链接。尽管在静态整站归档方面相当可靠,但其 CLI 早于 JSON 标准输出规范,且不带参数直接运行会进入阻塞交互的文本向导。

FCRS-1.0 综合评分
64 /100
可用但有局限
高置信度 (实测)
零摩擦安装命令
brew install httrack
CLI vs MCP 选型建议 仅 CLI 可用

专注于递归下载静态网站并重写本地离线链接,并非交互式浏览器自动化工具。

Agent 友好度体检单

本地探针实测证据
— 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md
实测版本
HTTrack version 3.49-2
冷启动耗时
47 ms
退出码 (help / 非法参数)
0 / 255
NO_COLOR 无色码污染 / 无 TTY 不挂起
Yes / Safe
抓取的 --help 摘要
HTTrack version 3.49-2
	usage: httrack <URLs> [-option] [+<URL_FILTER>] [-<URL_FILTER>] [+<mime:MIME_FILTER>] [-<mime:MIME_FILTER>]
	with options listed below: (* is the default value)

General options:
  O  path for mirror/logfiles+cache (-O path_mirror[,path_cache_and_logfiles]) (--path <param>)

Action options:
  w *mirror web sites (--mirror)
  W  mirror web sites, semi-automatic (asks questions) (--mirror-wizard)
  g  just get files (saved in the current directory) (--get-files)
  i  continue an interrupted mirror using the cache (--continue)
  Y   mirror ALL links located in the first level pages (mirror links) (--mirrorlinks)

Proxy options:
  P  proxy use (-P proxy:port or -P user:pass@proxy:port) (--proxy <param>)
 %f *use proxy for ftp (f0 don't use) (--httpproxy-ftp[=N])
 %b  use this local hostname to make/send requests (-%b hostname) (--bind <param>)

Limits options:
  rN set the mirror depth to N (* r9999) (--depth[=N])
 %eN set the external links depth to N (* %e0) (--ext-depth[=N])
  mN maximum file length for a non-html file (--max-files[=N])
  mN,N2 maximum file length for non html (N) and html (N2)
  MN maximum overall size that can be uploaded/scanned (--max-size[=N])
  EN maximum mirror time in seconds (60=1 minute, 3600=1 hour) (--max-time[=N])
  AN maximum transfer rate in bytes/seconds (1000=1KB/s max) (--max-rate[=N])
 %cN maximum number of connections/seconds (*%c10) (--connection-per-second[=N])
  GN pause transfer if N bytes reached, and wait until lock file is deleted (--max-pause[=N])

Flow control:
  cN number of multiple connections (*c8) (--sockets[=N])
  TN timeout, number of seconds after a non-responding link is shutdown (--timeout[=N])
  RN number of retries, in case of timeout or non-fatal errors (*R1) (--retries[=N])
  JN traffic jam control, minimum transfert rate (bytes/seconds) tolerated for a link (--min-rate[=N])
  HN host is abandonned if: 0=never, 1=timeout, 2=slow, 3=timeout or slow (--host-control[=N])

Links options:
 %P *extended parsing, attempt to parse all links, even in unknown tags or Javascript (%P0 don't use) (--extended-parsing[=N])
  n  get non-html files 'near' an html file (ex: an image located outside) (--near)
  t  test all URLs (even forbidden ones) (--test)
 %L <file> add all URL located in this text file (one URL per line) (--list <param>)
 %S <file> add all scan rules located in this text file (one scan rule per line) (--urllist <param>)

Build options:
  NN structure type (0 *original stru

FCRS-1.0 六维评分拆解

Agent 友好度 13 / 25

无参数运行 httrack 会进入交互式问答向导,参数语法偏晦涩(如 -%v0、-r2),且缺乏 JSON 标准输出。

  • Interactive prompt wizard when run bare; no JSON stdout flag
  • Requires -q and explicit URL/flags to run non-interactively
安全与权限边界 17 / 25

默认遵守 robots.txt 且仅写入 -O <dir>,但若未指定 -r 深度限制可能递归下载巨量文件。

  • Requires -r<N> depth cap to prevent full-site recursive downloads
安装与运行摩擦 11 / 15

可通过 Homebrew、Linux 包管理器与 Windows 安装包获取,但在现代平台上的构建包较为陈旧。

  • Installable via brew install httrack and apt
能力覆盖与边际价值 10 / 15

擅长静态 HTML 站点离线链接重写,但不具备现代 JS/SPA 渲染能力。

  • Static HTML parser; rewrites links for offline viewing
维护与来源背书 6 / 10

历史遗留社区代码库(xroche/httrack),近年来上游维护活跃度较低。

  • Infrequent commits in xroche/httrack
文档与可验证性 7 / 10

提供完整的传统 HTML 用户手册(fcguide.html)与 httrack --help。

  • Users guide hosted at httrack.com/html/fcguide.html

安全边界、鉴权与放权指南

鉴权方式
无需鉴权 本地配置文件
凭证存储位置

可选 Cookie 保存在每个镜像目录的 hts-cache/cookies.txt 中。

潜在副作用
只读查询 本地写入
费用与配额提示

免费且基于 GPL-3.0-or-later 开源的 C 语言工具。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# HTTrack Agent Rules
- Never run bare `httrack` with no arguments (it launches an interactive text wizard that blocks stdin).
- Always pass an explicit URL, `-O <dir>`, depth cap (`-r2`), and `-q` (`--quiet`).

Agent 高频安全命令配方

只读查询(安全推荐)

查看 HTTrack 参数而不进入向导
httrack --help

打印非交互参数参考而不触发 HTTrack 的交互式问答循环。

受控写入与预演

带深度限制和静默模式镜像站点
httrack https://example.com -O ./mirror -r2 -q -%v0

限制最大递归深度为 2(-r2)并以静默模式(-q -%v0)无交互镜像至 ./mirror。

核心优势

  • + 经过长期验证的静态 HTML 链接重写与增量镜像更新(--update)能力。
  • + 默认遵守 robots.txt 并支持速率控制。

注意事项与踩坑点

  • ! 不带参数直接运行 httrack 会进入交互式标准输入向导并阻塞 Agent。
  • ! 无 JSON 标准输出且旧式单字母/% 参数晦涩,无法渲染 JS 重度单页应用。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI