Playwright 爬虫技能是为 Openclaw Skills 生态系统构建的多功能数据提取引擎。它为开发者提供了分层抓取方案,允许根据目标网站的安全级别选择最有效的抓取方式。从简单的静态获取到绕过复杂的 Cloudflare 挑战,该技能确保您的 AI 代理能够访问所需的网页数据而不会被封锁。
通过利用 Playwright 的强大功能,该技能比传统的抓取库更有效地模拟人类浏览器行为。它包含了用于隐身操作的专门脚本,使其成为研究人员、开发者和数据分析师在 Openclaw Skills 集合中获取动态或受保护网页内容时不可或缺的工具。
下载入口:https://github.com/openclaw/skills/tree/main/skills/waisimon/playwright-scraper-skill从源直接安装技能的最快方式。
npx clawhub@latest install playwright-scraper-skill
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
<project>/skills/
优先级:工作区 > 本地 > 内置
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 playwright-scraper-skill。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
要将此功能集成到您的 Openclaw Skills 设置中,请遵循以下安装步骤:
cd playwright-scraper-skill
npm install
npx playwright install chromium
Playwright 爬虫技能将其输出组织成结构化格式,以确保与其他 Openclaw Skills 的兼容性。
| 属性 | 类型 | 描述 |
|---|---|---|
| url | 字符串 | 被抓取的目标 URL。 |
| title | 字符串 | 从元数据中提取的页面标题。 |
| content | 字符串 | 页面的主要文本或 HTML 内容。 |
| elapsedSeconds | 字符串 | 执行抓取所花费的总时间。 |
| screenshot | 路径 | (可选)生成的 PNG 截图的本地路径。 |
| html_file | 路径 | (可选)保存的原始 HTML 源码的本地路径。 |
name: playwright-scraper-skill
description: Playwright-based web scraping OpenClaw Skill with anti-bot protection. Successfully tested on complex sites like Discuss.com.hk.
version: 1.2.0
author: Simon Chan
A Playwright-based web scraping OpenClaw Skill with anti-bot protection. Choose the best approach based on the target website's anti-bot level.
| Target Website | Anti-Bot Level | Recommended Method | Script |
|---|---|---|---|
| Regular Sites | Low | web_fetch tool | N/A (built-in) |
| Dynamic Sites | Medium | Playwright Simple | scripts/playwright-simple.js |
| Cloudflare Protected | High | Playwright Stealth ? | scripts/playwright-stealth.js |
| YouTube | Special | deep-scraper | Install separately |
| Special | reddit-scraper | Install separately |
cd playwright-scraper-skill
npm install
npx playwright install chromium
Use OpenClaw's built-in web_fetch tool:
# Invoke directly in OpenClaw
Hey, fetch me the content from https://example.com
Use Playwright Simple:
node scripts/playwright-simple.js "https://example.com"
Example output:
{
"url": "https://example.com",
"title": "Example Domain",
"content": "...",
"elapsedSeconds": "3.45"
}
Use Playwright Stealth:
node scripts/playwright-stealth.js "https://m.discuss.com.hk/#hot"
Features:
navigator.webdriver = false)Use deep-scraper (install separately):
# Install deep-scraper skill
npx clawhub install deep-scraper
# Use it
cd skills/deep-scraper
node assets/you@tube_handler.js "https://[email protected]/watch?v=VIDEO_ID"
scripts/playwright-simple.jsscripts/playwright-stealth.js ?If the site doesn't have dynamic loading, use OpenClaw's web_fetch tool—it's fastest.
If you need to wait for JavaScript rendering, use playwright-simple.js.
If you encounter 403 or Cloudflare challenges, use playwright-stealth.js.
All scripts support environment variables:
# Set screenshot path
SCREENSHOT_PATH=/path/to/screenshot.png node scripts/playwright-stealth.js URL
# Set wait time (milliseconds)
WAIT_TIME=10000 node scripts/playwright-simple.js URL
# Enable headful mode (show browser)
HEADLESS=false node scripts/playwright-stealth.js URL
# Save HTML
SAVE_HTML=true node scripts/playwright-stealth.js URL
# Custom User-Agent
USER_AGENT="Mozilla/5.0 ..." node scripts/playwright-stealth.js URL
| Method | Speed | Anti-Bot | Success Rate (Discuss.com.hk) |
|---|---|---|---|
| web_fetch | ? Fastest | ? None | 0% |
| Playwright Simple | ?? Fast | ?? Low | 20% |
| Playwright Stealth | ?? Medium | ? Medium | 100% ? |
| Puppeteer Stealth | ?? Medium | ? Medium-High | ~80% |
| Crawlee (deep-scraper) | ?? Slow | ? Detected | 0% |
| Chaser (Rust) | ?? Medium | ? Detected | 0% |
Lessons learned from our testing:
navigator.webdriver — EssentialaddInitScript (Playwright) — Inject before page loadSolution: Use playwright-stealth.js
Solution:
headless: false (headful mode sometimes has higher success rate)Solution:
waitForTimeoutwaitUntil: 'networkidle' or 'domcontentloaded'Best Solution: Pure Playwright + anti-bot techniques (framework-independent)
browser tool