Linux command
lightpanda 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Fetch a URL
lightpanda fetch --dump html [url]
Fetch a URL
lightpanda fetch --dump markdown [url]
Start a CDP server
lightpanda serve
Start a CDP server
lightpanda serve --host [127.0.0.1] --port [9222]
Fetch a URL
lightpanda fetch --obey_robots --dump html [url]
Fetch a URL
lightpanda fetch --http_proxy [proxy_host:port] --dump html [url]
说明
Lightpanda is an open-source headless browser built from scratch in Zig with the V8 JavaScript engine, purpose-built for AI agents, web scraping, LLM training, and test automation. Unlike headless modes of traditional browsers, Lightpanda skips graphical rendering entirely, focusing only on DOM construction and JavaScript execution. It exposes a Chrome DevTools Protocol (CDP) endpoint, making it compatible with existing automation tools like Playwright, Puppeteer, and chromedp as a drop-in replacement for headless Chrome. The fetch command retrieves a single URL and dumps the rendered page, while serve launches a persistent CDP server for remote browser control. Lightpanda achieves 9x less memory usage and 11x faster execution compared to headless Chrome, making it particularly suited for high-volume scraping and automation workloads.
参数
- fetch
- Fetch a URL, execute JavaScript, and output the rendered page content to stdout.
- serve
- Start a Chrome DevTools Protocol (CDP) server for remote automation via Playwright, Puppeteer, or raw CDP clients.
- help
- Display available commands and options.
- --dump _html_|_markdown_
- Output format for the fetched page. Use html for rendered HTML or markdown for a Markdown conversion. (fetch only)
- --with_base
- Add a \<base\> tag in the dumped output. (fetch only)
- --host _address_
- Host address for the CDP server. Default 127.0.0.1. (serve only)
- --port _port_
- Port for the CDP server. Default 9222. (serve only)
- --timeout _seconds_
- Inactivity timeout in seconds before disconnecting clients. Default 10. (serve only)
- --obey_robots
- Fetch and obey the robots.txt of the target web pages.
- --http_proxy _host:port_
- HTTP proxy to use for all requests. Supports optional username:password for basic authentication.
- --http_timeout _milliseconds_
- Maximum time in milliseconds the transfer is allowed to complete. 0 means no timeout. Default 10000.
- --log_level _level_
- Set logging verbosity. Default info. Use debug for detailed output.
- --log_format _format_
- Set log output format. Use pretty for human-readable output.
FAQ
What is the lightpanda command used for?
Lightpanda is an open-source headless browser built from scratch in Zig with the V8 JavaScript engine, purpose-built for AI agents, web scraping, LLM training, and test automation. Unlike headless modes of traditional browsers, Lightpanda skips graphical rendering entirely, focusing only on DOM construction and JavaScript execution. It exposes a Chrome DevTools Protocol (CDP) endpoint, making it compatible with existing automation tools like Playwright, Puppeteer, and chromedp as a drop-in replacement for headless Chrome. The fetch command retrieves a single URL and dumps the rendered page, while serve launches a persistent CDP server for remote browser control. Lightpanda achieves 9x less memory usage and 11x faster execution compared to headless Chrome, making it particularly suited for high-volume scraping and automation workloads.
How do I run a basic lightpanda example?
Run `lightpanda fetch --dump html [url]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does fetch do in lightpanda?
Fetch a URL, execute JavaScript, and output the rendered page content to stdout.