lightpanda-browser by aradotso/trending-skills
npx skills add https://github.com/aradotso/trending-skills --skill lightpanda-browserSkill by ara.so — Daily 2026 Skills 集合
Lightpanda 是一个使用 Zig 语言从头构建的无头浏览器,专为 AI 智能体、网页抓取和自动化设计。其内存占用比 Chrome 无头模式少 9 倍,运行速度快 11 倍。
关键信息:
--obey_robots 标志遵守 robots.txt 规则curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-aarch64-macos
chmod a+x ./lightpanda
curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-x86_64-linux
chmod a+x ./lightpanda
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 支持 amd64 和 arm64
docker run -d --name lightpanda -p 9222:9222 lightpanda/browser:nightly
./lightpanda fetch --obey_robots --log_format pretty --log_level info https://example.com
./lightpanda serve --obey_robots --log_format pretty --log_level info --host 127.0.0.1 --port 9222
这将启动一个基于 WebSocket 的 CDP 服务器,用于编程控制。
| 标志 | 描述 |
|---|---|
--obey_robots | 遵守 robots.txt 规则 |
--log_format pretty | 人类可读的日志输出 |
--log_level info | 日志详细程度:debug、info、warn、error |
--host 127.0.0.1 | CDP 服务器的绑定地址 |
--port 9222 | CDP 服务器的端口 |
--insecure_disable_tls_host_verification | 禁用 TLS 验证(仅用于测试) |
启动 CDP 服务器,然后让 Playwright 连接到它:
import { chromium } from 'playwright-core';
const browser = await chromium.connectOverCDP('http://127.0.0.1:9222');
const context = await browser.contexts()[0] || await browser.newContext();
const page = await context.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle' });
const title = await page.title();
const content = await page.content();
console.log(`Title: ${title}`);
console.log(`HTML length: ${content.length}`);
await browser.close();
import puppeteer from 'puppeteer-core';
const browser = await puppeteer.connect({
browserWSEndpoint: 'ws://127.0.0.1:9222',
});
const context = await browser.createBrowserContext();
const page = await context.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle0' });
const title = await page.title();
const text = await page.evaluate(() => document.body.innerText);
console.log(`Title: ${title}`);
console.log(`Body text: ${text.substring(0, 200)}`);
await page.close();
await browser.close();
package main
import (
"context"
"fmt"
"log"
"github.com/chromedp/chromedp"
)
func main() {
allocCtx, cancel := chromedp.NewRemoteAllocator(context.Background(), "ws://127.0.0.1:9222")
defer cancel()
ctx, cancel := chromedp.NewContext(allocCtx)
defer cancel()
var title string
err := chromedp.Run(ctx,
chromedp.Navigate("https://example.com"),
chromedp.Title(&title),
)
if err != nil {
log.Fatal(err)
}
fmt.Println("Title:", title)
}
import asyncio
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
browser = await p.chromium.connect_over_cdp("http://127.0.0.1:9222")
context = browser.contexts[0] if browser.contexts else await browser.new_context()
page = await context.new_page()
await page.goto("https://example.com", wait_until="networkidle")
title = await page.title()
content = await page.content()
print(f"Title: {title}")
print(f"HTML length: {len(content)}")
await browser.close()
asyncio.run(main())
import { chromium } from 'playwright-core';
const browser = await chromium.connectOverCDP('http://127.0.0.1:9222');
const context = await browser.newContext();
const urls = [
'https://example.com/page1',
'https://example.com/page2',
'https://example.com/page3',
];
for (const url of urls) {
const page = await context.newPage();
await page.goto(url, { waitUntil: 'networkidle' });
const data = await page.evaluate(() => ({
title: document.title,
text: document.body.innerText,
links: [...document.querySelectorAll('a[href]')].map(a => a.href),
}));
console.log(JSON.stringify(data, null, 2));
await page.close();
}
await browser.close();
const data = await page.evaluate(() => {
const items = document.querySelectorAll('.product-card');
return [...items].map(item => ({
name: item.querySelector('h2')?.textContent?.trim(),
price: item.querySelector('.price')?.textContent?.trim(),
link: item.querySelector('a')?.href,
}));
});
services:
lightpanda:
image: lightpanda/browser:nightly
ports:
- "9222:9222"
restart: unless-stopped
scraper:
build: .
depends_on:
- lightpanda
environment:
- BROWSER_WS_ENDPOINT=ws://lightpanda:9222
Lightpanda 支持(部分,正在扩展):
| 环境变量 | 描述 |
|---|---|
LIGHTPANDA_DISABLE_TELEMETRY | 设置为 true 以选择退出使用情况指标收集 |
| 指标 | Lightpanda | Chrome Headless |
|---|---|---|
| 内存 | 约少 9 倍 | 基准 |
| 速度 | 约快 11 倍 | 基准 |
| 二进制大小 | 小(Zig) | 大(Chromium) |
| 渲染 | 无视觉渲染 | 完整的渲染引擎 |
在以下情况使用 Lightpanda:
在以下情况使用 Chrome/Playwright:
要求:Zig 0.15.2、Rust、CMake、系统依赖。
# Ubuntu/Debian 依赖项
sudo apt install xz-utils ca-certificates pkg-config libglib2.0-dev clang make curl
# 构建
git clone https://github.com/lightpanda-io/browser.git
cd browser
zig build
# 可选:预构建 V8 快照以加快启动速度
zig build snapshot_creator -- src/snapshot.bin
zig build -Dsnapshot_path=../../snapshot.bin
端口 9222 连接被拒绝:
./lightpanda serve 正在运行--host 0.0.0.0Playwright 脚本在更新后中断:
缺少 Web API 支持:
每周安装量
386
仓库
GitHub 星标数
10
首次出现
9 天前
安全审计
安装于
opencode382
gemini-cli382
codex382
kimi-cli382
amp382
cline382
Skill by ara.so — Daily 2026 Skills collection
Lightpanda is a headless browser built from scratch in Zig, designed for AI agents, web scraping, and automation. It uses 9x less memory and runs 11x faster than Chrome headless.
Key facts:
robots.txt via --obey_robots flagcurl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-aarch64-macos
chmod a+x ./lightpanda
curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-x86_64-linux
chmod a+x ./lightpanda
# Supports amd64 and arm64
docker run -d --name lightpanda -p 9222:9222 lightpanda/browser:nightly
./lightpanda fetch --obey_robots --log_format pretty --log_level info https://example.com
./lightpanda serve --obey_robots --log_format pretty --log_level info --host 127.0.0.1 --port 9222
This launches a WebSocket-based CDP server for programmatic control.
| Flag | Description |
|---|---|
--obey_robots | Respect robots.txt rules |
--log_format pretty | Human-readable log output |
--log_level info | Log verbosity: debug, info, warn, error |
--host 127.0.0.1 |
Start the CDP server, then connect Playwright to it:
import { chromium } from 'playwright-core';
const browser = await chromium.connectOverCDP('http://127.0.0.1:9222');
const context = await browser.contexts()[0] || await browser.newContext();
const page = await context.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle' });
const title = await page.title();
const content = await page.content();
console.log(`Title: ${title}`);
console.log(`HTML length: ${content.length}`);
await browser.close();
import puppeteer from 'puppeteer-core';
const browser = await puppeteer.connect({
browserWSEndpoint: 'ws://127.0.0.1:9222',
});
const context = await browser.createBrowserContext();
const page = await context.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle0' });
const title = await page.title();
const text = await page.evaluate(() => document.body.innerText);
console.log(`Title: ${title}`);
console.log(`Body text: ${text.substring(0, 200)}`);
await page.close();
await browser.close();
package main
import (
"context"
"fmt"
"log"
"github.com/chromedp/chromedp"
)
func main() {
allocCtx, cancel := chromedp.NewRemoteAllocator(context.Background(), "ws://127.0.0.1:9222")
defer cancel()
ctx, cancel := chromedp.NewContext(allocCtx)
defer cancel()
var title string
err := chromedp.Run(ctx,
chromedp.Navigate("https://example.com"),
chromedp.Title(&title),
)
if err != nil {
log.Fatal(err)
}
fmt.Println("Title:", title)
}
import asyncio
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
browser = await p.chromium.connect_over_cdp("http://127.0.0.1:9222")
context = browser.contexts[0] if browser.contexts else await browser.new_context()
page = await context.new_page()
await page.goto("https://example.com", wait_until="networkidle")
title = await page.title()
content = await page.content()
print(f"Title: {title}")
print(f"HTML length: {len(content)}")
await browser.close()
asyncio.run(main())
import { chromium } from 'playwright-core';
const browser = await chromium.connectOverCDP('http://127.0.0.1:9222');
const context = await browser.newContext();
const urls = [
'https://example.com/page1',
'https://example.com/page2',
'https://example.com/page3',
];
for (const url of urls) {
const page = await context.newPage();
await page.goto(url, { waitUntil: 'networkidle' });
const data = await page.evaluate(() => ({
title: document.title,
text: document.body.innerText,
links: [...document.querySelectorAll('a[href]')].map(a => a.href),
}));
console.log(JSON.stringify(data, null, 2));
await page.close();
}
await browser.close();
const data = await page.evaluate(() => {
const items = document.querySelectorAll('.product-card');
return [...items].map(item => ({
name: item.querySelector('h2')?.textContent?.trim(),
price: item.querySelector('.price')?.textContent?.trim(),
link: item.querySelector('a')?.href,
}));
});
services:
lightpanda:
image: lightpanda/browser:nightly
ports:
- "9222:9222"
restart: unless-stopped
scraper:
build: .
depends_on:
- lightpanda
environment:
- BROWSER_WS_ENDPOINT=ws://lightpanda:9222
Lightpanda supports (partial, expanding):
| Environment Variable | Description |
|---|---|
LIGHTPANDA_DISABLE_TELEMETRY | Set to true to opt out of usage metrics |
| Metric | Lightpanda | Chrome Headless |
|---|---|---|
| Memory | ~9x less | Baseline |
| Speed | ~11x faster | Baseline |
| Binary size | Small (Zig) | Large (Chromium) |
| Rendering | No visual rendering | Full rendering engine |
Use Lightpanda when:
Use Chrome/Playwright instead when:
Requires: Zig 0.15.2, Rust, CMake, system dependencies.
# Ubuntu/Debian dependencies
sudo apt install xz-utils ca-certificates pkg-config libglib2.0-dev clang make curl
# Build
git clone https://github.com/lightpanda-io/browser.git
cd browser
zig build
# Optional: pre-build V8 snapshot for faster startup
zig build snapshot_creator -- src/snapshot.bin
zig build -Dsnapshot_path=../../snapshot.bin
Connection refused on port 9222:
./lightpanda serve is running--host 0.0.0.0 if connecting from Docker/remotePlaywright script breaks after update:
Missing Web API support:
Weekly Installs
386
Repository
GitHub Stars
10
First Seen
9 days ago
Security Audits
Gen Agent Trust HubFailSocketPassSnykFail
Installed on
opencode382
gemini-cli382
codex382
kimi-cli382
amp382
cline382
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
138,300 周安装
Spring Boot Saga模式:微服务分布式事务解决方案与实现指南
349 周安装
WordPress站点设置与连接配置指南:WP-CLI与REST API完整教程
349 周安装
营销心理学实战指南:心智模型与行为设计,提升转化率与用户体验
349 周安装
Spring Boot @JsonTest JSON序列化单元测试指南:JacksonTester使用与最佳实践
349 周安装
scikit-learn 机器学习教程:Python 分类、回归、聚类、降维与模型评估实战指南
350 周安装
技术文档撰写专家 | AI辅助生成用户指南、API文档、架构文档、教程
350 周安装
| Bind address for CDP server |
--port 9222 | Port for CDP server |
--insecure_disable_tls_host_verification | Disable TLS verification (testing only) |