数据采集器:高性能网页数据提取 - Openclaw Skills
作者:互联网
2026-03-29
什么是 数据采集器?
数据采集器是一款专为高效网页数据采集和结构化文本提取而设计的强大工具。通过利用基于 curl 的解析而非沉重的浏览器环境,它提供了一种快速且资源高效的方式,将原始 HTML 转换为可用格式。作为 Openclaw Skills 生态系统的一部分,该工具将复杂的爬取任务简化为直接的 CLI 命令,非常适合需要速度和可靠性的开发人员及数据分析师。
该工具擅长剥离脚本和样式等不必要的模板内容,留下干净、可读的内容。无论您是进行市场调研还是构建本地知识库,数据采集器都能提供从任何公开 URL 隔离特定数据点所需的精确度。
下载入口:https://github.com/openclaw/skills/tree/main/skills/mupengi-bot/data-scraper
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install data-scraper
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 data-scraper。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
数据采集器 应用场景
- 从博客文章、新闻报道和技术文档中提取干净的 Markdown 文本。
- 抓取电子商务竞争分析的产品列表和价格数据。
- 监控特定的网页元素以跟踪降价或库存变化。
- 自动从 URL 列表进行批量数据采集,用于大规模研究。
- 将旧版 HTML 表格转换为现代、结构化的 JSON 或 CSV 格式。
- 用户通过 CLI 使用 fetch、extract 或 table 等特定模式发起请求。
- 技能使用优化的 curl 请求获取目标 URL 的 HTML 内容。
- 引擎根据提供的 CSS 选择器或默认的可读性逻辑解析 HTML。
- 提取的数据被结构化为用户首选的格式,如 JSON、CSV 或 Markdown。
- 对于监控任务,系统会将当前快照与 snapshots 目录中存储的历史记录进行对比以检测差异。
数据采集器 配置指南
要在您的环境中使用此技能,请确保您拥有网络访问的必要权限。您可以使用以下命令测试安装:
# 从 URL 获取并清理文本
data-scraper fetch "https://example.com"
# 使用 CSS 选择器提取特定数据
data-scraper extract "https://example.com" --selector ".price"
数据采集器 数据架构与分类体系
该技能通过结构化层级管理数据,以确保便携性和清晰度:
| 组件 | 类型 | 描述 |
|---|---|---|
| 快照 (Snapshots) | 文件 | 存储在 data-scraper/snapshots/ 中带有时间戳的页面版本 |
| 表格输出 | JSON | 键名派生自表头的对象数组 |
| 批量配置 | TXT | 用于顺序处理的简单 URL 列表 |
| 元数据 | 对象 | 包括 User-Agent 字符串、Cookie 数据和自定义标头 |
name: data-scraper
description: Web page data collection and structured text extraction
version: 1.0.0
author: ??? ??
data-scraper
Web Data Scraper — Extract structured data from web pages using curl + parsing. Lightweight, no browser required. Supports HTML-to-text, table extraction, price monitoring, and batch scraping.
When to Use
- Extract text content from web pages (articles, blogs, docs)
- Scrape product prices, reviews, or listings
- Monitor pages for changes (price drops, new content)
- Batch-collect data from multiple URLs
- Convert HTML tables to structured formats (JSON/CSV)
Quick Start
# Extract readable text from URL
data-scraper fetch "https://example.com/article"
# Extract specific elements
data-scraper extract "https://example.com" --selector "h2, .price"
# Monitor for changes
data-scraper watch "https://example.com/product" --interval 3600
Extraction Modes
Text Mode (default)
Fetches page and extracts readable content, stripping HTML tags, scripts, and styles. Similar to reader mode.
data-scraper fetch URL
# Output: clean markdown text
Selector Mode
Target specific CSS selectors for precise extraction.
data-scraper extract URL --selector ".product-title, .price, .rating"
# Output: matched elements as structured data
Table Mode
Extract HTML tables into structured formats.
data-scraper table URL --index 0
# Output: JSON array of row objects (header → value mapping)
Link Mode
Extract all links from a page with optional filtering.
data-scraper links URL --filter "*.pdf"
# Output: filtered list of absolute URLs
Batch Scraping
# Scrape multiple URLs
data-scraper batch urls.txt --output results/
# With rate limiting
data-scraper batch urls.txt --delay 2000 --output results/
urls.txt format:
https://site1.com/page
https://site2.com/page
https://site3.com/page
Change Monitoring
# Watch for changes, alert on diff
data-scraper watch URL --selector ".price" --interval 3600
# Compare with previous snapshot
data-scraper diff URL
Stores snapshots in data-scraper/snapshots/ with timestamps. Alerts via notification-hub when changes detected.
Output Formats
| Format | Flag | Use Case |
|---|---|---|
| Text | --format text |
Reading, summarization |
| JSON | --format json |
Data processing |
| CSV | --format csv |
Spreadsheets |
| Markdown | --format md |
Documentation |
Headers & Auth
# Custom headers
data-scraper fetch URL --header "Authorization: Bearer TOKEN"
# Cookie-based auth
data-scraper fetch URL --cookie "session=abc123"
# User-Agent override
data-scraper fetch URL --ua "Mozilla/5.0..."
Rate Limiting & Ethics
- Default: 1 request per second per domain
- Respects
robots.txtwhen--politeflag is set - Configurable delay between requests
- Stops on 429 (Too Many Requests) and backs off
Error Handling
| Error | Behavior |
|---|---|
| 404 | Log and skip |
| 403/401 | Warn about auth requirement |
| 429 | Exponential backoff (max 3 retries) |
| Timeout | Retry once with longer timeout |
| SSL error | Warn, option to proceed with --insecure |
Integration
- web-claude: Use as fallback when web_fetch isn't enough
- competitor-watch: Feed scraped data into competitor analysis
- seo-audit: Scrape competitor pages for SEO comparison
- performance-tracker: Collect social metrics from public profiles
相关推荐
