Convert any webpage into a single .mhtml file, embedding all resources (images, CSS, JS) for offline viewing. Output format is compatible with Chrome/Edge browsers.
python ~/.qclaw/skills/html-to-mhtml/scripts/html_to_mhtml.py "<URL>" [output.mhtml]
Examples:
# Save to auto-generated filename
python html_to_mhtml.py "https://example.com"
# Specify output filename
python html_to_mhtml.py "https://news.ycombinator.com" "hn_archive.mhtml"
# Save Chinese webpage
python html_to_mhtml.py "https://www.baidu.com" "baidu_home.mhtml"
| Parameter | Required | Description |
|---|---|---|
| ----------- | ---------- | ------------- |
| URL | Yes | Webpage URL to convert |
| output | No | Output .mhtml filename (auto-generated if omitted) |
pip install -r requirements.txt
The script generates MHTML in Chrome's native format:
From: headerSnapshot-Content-Location for original URLquoted-printable encoding for HTML/CSS/JSbase64 encoding for images and binary filesContent-ID: formatpython html_to_mhtml.py "" 共 2 个版本