360 Secure SkillHub
360 安全技能中心

Web Scraper

这是一款支持JavaScript渲染的网页抓取工具,核心功能涵盖静态/动态页面解析、CSS/XPath/正则选择器提取、AI自动识别数据模式及多页爬取。适用于提取网页结构化数据、抓取动态加载内容、批量爬取多页场景。通过命令行传参,输出JSON格式的抓取结果,默认遵守速率限制与robots.txt规范。

jpengcheng523-netizen
jpengcheng523-netizen
热度 53.31
最近更新 2026-05-11 17:35:58
分类:自动化依赖:联网浏览搜索 / 代码执行应用场景:数据处理 / 自动化脚本 / 研究

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add jpeng-web-scraper
Metadata
name
jpeng-web-scraper
description
Web scraping skill with JavaScript rendering support. Extract data from websites using CSS selectors, XPath, or AI-powered extraction.
version
1.0.0
author
jpeng
tags
["web","scraping","extraction","crawler","playwright"]

Web Scraper

Extract data from websites with support for dynamic content.

When to Use

  • User wants to scrape data from a website
  • Extract structured data from HTML
  • Handle JavaScript-rendered pages
  • Crawl multiple pages

Features

  • Static pages: Fast HTML parsing
  • Dynamic pages: Playwright/Puppeteer rendering
  • Selectors: CSS, XPath, regex
  • AI extraction: Auto-detect data patterns

Usage

Simple scrape

python3 scripts/scrape.py \
  --url "https://example.com/products" \
  --selector ".product-name" \
  --output ./products.json

With JavaScript rendering

python3 scripts/scrape.py \
  --url "https://spa-example.com/data" \
  --render \
  --wait 2000 \
  --selector ".data-item"

Extract multiple fields

python3 scripts/scrape.py \
  --url "https://example.com/listings" \
  --fields '{
    "title": "h1.title",
    "price": ".price",
    "description": ".desc"
  }'

Crawl multiple pages

python3 scripts/scrape.py \
  --url "https://example.com/page/1" \
  --crawl 'a[href*="/page/"]' \
  --max-pages 10 \
  --selector ".item"

AI-powered extraction

python3 scripts/scrape.py \
  --url "https://example.com/article" \
  --ai-extract "Extract the title, author, and publication date"

Output

{
  "success": true,
  "url": "https://example.com/products",
  "items": [
    {"name": "Product 1", "price": "$99"},
    {"name": "Product 2", "price": "$149"}
  ],
  "scraped_at": "2024-01-15T10:30:00Z"
}

Rate Limiting

  • Default delay: 1 second between requests
  • Respects robots.txt
  • Customizable user agent