headless-web-viewer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Headless Web Viewer

无头网页查看器

Run

运行

Render + save artifacts

渲染并保存产物

bash
node ./scripts/render_url_playwright.mjs '<URL>' \
  --out-html /tmp/page.html \
  --out-text /tmp/page.txt \
  --out-screenshot /tmp/page.png
bash
node ./scripts/render_url_playwright.mjs '<URL>' \
  --out-html /tmp/page.html \
  --out-text /tmp/page.txt \
  --out-screenshot /tmp/page.png

Print to stdout (pipe-friendly)

打印到标准输出(支持管道)

bash
node ./scripts/render_url_playwright.mjs '<URL>' --print text
bash
node ./scripts/render_url_playwright.mjs '<URL>' --print text

Dependencies

依赖项

This skill requires Playwright in the environment where it runs.
此技能运行环境需要Playwright。

Option A (recommended for global use, no browser download)

选项A(全局使用推荐,无需下载浏览器)

Install Playwright Core and use system Chrome:
bash
npm i -D playwright-core
Run with
--channel chrome
.
安装Playwright Core并使用系统Chrome:
bash
npm i -D playwright-core
运行时添加
--channel chrome
参数。

Option B (bundled browsers)

选项B(捆绑浏览器)

bash
npm i -D playwright
npx playwright install
Do not auto-install dependencies unless the user asks.
bash
npm i -D playwright
npx playwright install
除非用户要求,否则不要自动安装依赖项。

Tips

提示

  • If a page hangs on
    networkidle
    , retry with
    --wait-until domcontentloaded
    .
  • If a page blocks headless Chromium, try setting
    --user-agent
    to a realistic UA.
  • 如果页面在
    networkidle
    状态下挂起,尝试使用
    --wait-until domcontentloaded
    参数重试。
  • 如果页面拦截无头Chromium,尝试将
    --user-agent
    设置为真实的用户代理字符串。