Skip to content
lafflanPublic

About

AI生成的自适应Web爬虫框架,支持CSS/XPath选择器、自动重试、浏览器渲染。用于网页抓取、内容提取、智能数据采集和截图

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scrapling-skill

自适应 Web 爬虫框架,基于 D4Vinci/Scrapling,提供网页抓取、内容提取、智能数据采集、截图和数据导出功能。

特性

  • 🚀 超快速度 - 比 BeautifulSoup 快 1000 倍
  • 🧠 自适应 - 解析器能"学习"网站结构变化,自动重新适配
  • 🎭 多种模式 - 静态请求、隐身模式、动态渲染(Playwright)
  • 🔄 自动重试 - 内置错误处理和重试机制
  • 📝 编码处理 - 自动处理各种编码问题

安装

pip install scrapling>=1.0.0 playwright>=1.40.0 pandas>=2.0.0
playwright install chromium

快速开始

from fetch import scrapling_fetch
from extract import scrapling_extract
from auto import scrapling_auto

# 网页抓取
html = scrapling_fetch("https://example.com")

# 使用选择器提取
title = scrapling_fetch("https://example.com", selector="h1")

# 智能抓取
data = scrapling_auto("https://news.ycombinator.com/")

工具模块

模块 功能
fetch 网页抓取(static/stealth/dynamic 模式)
extract CSS/XPath 内容提取
auto 自动检测页面数据结构
screenshot 网页截图
export JSON/CSV 格式转换

抓取模式

模式 说明 适用场景
static 静态 HTML 请求 简单页面
stealth 隐身模式,反反爬 需要规避检测的网站
dynamic JavaScript 渲染 React/Vue/Angular 等 SPA

运行测试

python test_scrapling.py
python test_hackernews.py
python test_scrapling_local.py

项目结构

scrapling/
├── tools/
│   ├── fetch.py      # 网页抓取
│   ├── extract.py    # 内容提取
│   ├── auto.py       # 智能抓取
│   ├── screenshot.py # 截图
│   └── export.py     # 格式转换
├── pyproject.toml
├── SKILL.md
└── test_*.py

About

AI生成的自适应Web爬虫框架,支持CSS/XPath选择器、自动重试、浏览器渲染。用于网页抓取、内容提取、智能数据采集和截图

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages