简介
安全提取公开网页内容,自动清洗格式并本地存储,支持后续分析处理,零外部依赖。
原始描述
Structured extraction and cleanup for public, user-authorized web pages. Use when the user wants to collect, clean, summarize, or transform content from acce...
中文使用说明 来自收录源
核心用法
Scraper 是一款基于 Python 标准库的轻量级网页抓取工具,专为将公开网页内容转化为可复用数据而设计。用户通过简单的命令行脚本即可完成页面获取、文本提取和本地存储的全流程:使用 fetch_page.py 下载目标页面,extract_text.py 将 HTML 转换为清理后的纯文本,save_output.py 保存结构化输出并注册任务记录,list_jobs.py 查看历史抓取任务。所有输出严格保存在本地 ~/.openclaw/workspace/memory/scraper/ 目录,不上传至任何外部服务器。
显著优点
- 零外部依赖:仅使用 Python 3 标准库,无需安装额外包,部署极简
- 安全边界清晰:明确禁止绕过登录、付费墙、验证码、robots 限制和速率限制,仅处理用户授权的公开页面
- 隐私友好:不收集敏感数据,符合 GDPR 数据最小化原则
- 透明可信:AGIstack 维护,MIT-0 开源协议,350 行代码规模适中易于审计
- 稳健实现:20 秒网络超时、原子文件写入、文件名清理(slugify)、明确 User-Agent 标识
潜在局限
- 功能单一:仅支持基础 GET 请求,不支持 JavaScript 渲染、表单交互、Cookie 会话等复杂场景
- 无内容过滤:当前未对 HTTP Content-Type 进行校验,可能意外下载非文本内容
- 无 URL 白名单:依赖用户自律,未内置域名限制机制
- T3 来源级别:社区项目属性,建议生产环境使用前额外验证
适合人群
- 研究人员、分析师需批量收集公开文章、文档进行后续 NLP 处理
- 开发者构建数据集前的内容抓取环节
- 注重隐私、希望数据完全本地化的用户
- 需要轻量替代方案、避免重型爬虫框架(如 Scrapy)开销的场景
常规风险
- 网络层面:访问用户提供的 URL 可能下载恶意内容,需确保 URL 来源可信
- 存储层面:本地文件操作虽经路径清理,但长期积累的输出可能包含敏感信息,建议定期清理
- 合规层面:用户需自行确保抓取行为符合目标网站的 robots.txt 和使用条款
评分依据
CLS-Certify 综合评分 85 分(Grade A),静态分析 90 分、动态行为 85 分、依赖审计满分、隐私合规 85 分。主要扣分项为网络流量分析的开放性(80 分),属功能预期内的设计权衡。
技能正文
name: scraper description: Structured extraction and cleanup for public, user-authorized web pages. Use when the user wants to collect, clean, summarize, or transform content from accessible pages into reusable text or data. Do not use to bypass logins, paywalls, captchas, robots restrictions, or access controls. Local-only output.
Scraper
Turn messy public pages into clean, reusable data.
Core Purpose
Scraper is a safe extraction skill for public, user-authorized pages. It helps the agent:
- fetch page content from a URL
- extract readable text
- strip boilerplate where possible
- save clean output locally
- prepare content for later summarization or analysis
Safety Boundaries
- Only use on public or user-authorized pages
- Do not bypass logins, paywalls, captchas, robots restrictions, or rate limits
- Do not request or store credentials
- Do not perform stealth scraping, account creation, or identity evasion
- Save outputs locally only
Runtime Requirements
- Python 3 must be available as
python3 - No external packages required
Local Storage
All outputs are stored locally under:
~/.openclaw/workspace/memory/scraper/jobs.json~/.openclaw/workspace/memory/scraper/output/
Key Workflows
- Capture a page:
fetch_page.py --url "https://example.com" - Extract readable text:
extract_text.py --url "https://example.com" - Save cleaned content:
save_output.py --url "https://example.com" --title "Example" - List prior jobs:
list_jobs.py
Scripts
| Script | Purpose |
|---|---|
init_storage.py |
Initialize scraper storage |
fetch_page.py |
Download a page with standard headers |
extract_text.py |
Convert HTML into cleaned plain text |
save_output.py |
Save extracted output and register a job |
list_jobs.py |
Show past scraping jobs |
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。