Browser

Lightpanda Browser

Try it

Lightpanda is a lightweight, Zig-based headless browser 9x faster and 16x more memory-efficient than Chrome for web scraping and content extraction.

What it does

Lightpanda 是用 Zig 编写的轻量级无头浏览器,非 Chromium 分支。

The skill document

Lightpanda / 轻量级无头浏览器

简介 / Introduction

Lightpanda 是用 Zig 编写的轻量级无头浏览器,非 Chromium 分支。

性能对比:

指标LightpandaHeadless Chrome差距
内存 (100页)123MB2GB16x 更省
速度 (100页)5s46s9x 更快

安装 / Installation

# Linux
curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-x86_64-linux && \
chmod a+x ./lightpanda

# macOS
curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-aarch64-macos && \
chmod a+x ./lightpanda

使用方法 / Usage

基本命令 / Basic Commands

# 查看版本
./lightpanda version

# 抓取网页为 HTML
./lightpanda fetch --obey-robots --dump html --log-format pretty --log-level info 

# 抓取网页为 Markdown(推荐)
./lightpanda fetch --obey-robots --dump markdown --log-format pretty --log-level info 

# 等待加载后再抓取
./lightpanda fetch --obey-robots --dump markdown --wait-ms 3000 

# 等待特定元素
./lightpanda fetch --obey-robots --dump markdown --wait-selector ".content" 

Python 调用 / Python Integration

import subprocess
import re

def fetch_url(url, format="markdown", wait_ms=2000):
    """使用 Lightpanda 抓取网页"""
    output_format = "markdown" if format == "markdown" else "html"
    cmd = [
        "./lightpanda", "fetch",
        "--obey-robots",
        "--dump", output_format,
        "--wait-ms", str(wait_ms),
        "--log-format", "pretty",
        url
    ]
    result = subprocess.run(cmd, capture_output=True, text=True)
    return result.stdout

# 使用示例
content = fetch_url("https://example.com", "markdown")
print(content)

适用场景 / Use Cases

场景说明
🌐 网页抓取轻量快速,适合批量抓取
📄 内容提取转 Markdown,方便后续处理
🔍 竞品分析定期抓取页面内容
📰 新闻聚合抓取文章内容
📊 数据监控监控网页变化

注意事项 / Notes

  • 无需 Chrome:独立二进制,不依赖系统浏览器
  • CDP 协议:支持 Puppeteer/Playwright 连接(高级用法)
  • 遵守 robots.txt:默认 --obey-robots
  • 输出格式:推荐使用 --dump markdown 便于后续处理

Docker 部署 / Docker Deployment

docker run -d --name lightpanda -p 127.0.0.1:9222:9222 lightpanda/browser:nightly

示例 / Examples

抓取网页并保存

./lightpanda fetch --obey-robots --dump markdown --log-format pretty --log-level info https://news.ycombinator.com > output.md

批量抓取

import subprocess
import time

urls = [
    "https://example.com/page1",
    "https://example.com/page2",
    "https://example.com/page3"
]

for url in urls:
    print(f"Fetching: {url}")
    result = subprocess.run(
        ["./lightpanda", "fetch", "--obey-robots", "--dump", "markdown", "--wait-ms", "2000", url],
        capture_output=True,
        text=True
    )
    # 处理 result.stdout
    time.sleep(1)  # 礼貌性延迟

与 LangChain/文档处理结合

import subprocess

def scrape_for_rag(url):
    """抓取网页用于 RAG 处理"""
    result = subprocess.run(
        ["./lightpanda", "fetch", "--obey-robots", "--dump", "markdown", "--wait-ms", "3000", url],
        capture_output=True,
        text=True
    )
    return result.stdout

Related skills

Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.

by nssa.io1.0k installs47 stars

Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.

by johnpatternai22 installs8 stars

Fetch raw ad creative, app, ranking, and revenue data from AdMapix as structured JSON.

by fly0pants4.3k installs296 stars

Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.

by Iván855 installs69 stars

More from smseow001

Browse all skills

AI architecture diagram generator supporting Mermaid charts. Generate system architecture, cloud architecture, neural network, graph theory, flowchart, ER di...

by SMS41 installs1 stars

让AI代理控制浏览器自动化网页操作。支持 Claude/GPT/Gemini/Ollama,可执行填表、购物、搜索等任务。

by smseow00120 installs

谷歌开源 AI 编程工作流 - 从需求到代码的快速转化。包含20个专项技能、规范开发流程、7大实战案例。

by smseow00117 installs

ComfyUI V8 秋叶中文版 全流程助手。提供安装检测、一键启动、工作流生成(文生图/图生图/ControlNet/InstantID等)、参数优化、故障排查、批量生成、模型管理等功能。All-in-one assistant for ComfyUI V8 (Aki bundle) with workflow...

by smseow00117 installs

硅谷多智能体量化交易系统 - 三级架构(研究员/分析师/交易员)+ 完整量化流程 + 新手平台推荐 + 策略指南。

by smseow00114 installs

将 OpenClaw 升级为 Claude-Code 引擎架构 - 并发执行/自我反思/向量检索/子代理系统/上下文压缩

by smseow00114 installs