# Scrapling Web Fetch

> Scrapling Web Fetch Skill

- Skill: `xushengyu2003-sys/scrapling-web-fetch` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add xushengyu2003-sys/scrapling-web-fetch`
- Raw SKILL.md: https://api.skillmd.com/api/skills/xushengyu2003-sys/scrapling-web-fetch/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: xushengyu2003-sys (https://skillmd.com/u/xushengyu2003-sys)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/xushengyu2003-sys/scrapling-web-fetch

---

# Scrapling Web Fetch Skill

> 永久免费的网页提取方案 - 基于石臻说AI文章

**作者**: 石臻说AI
**GitHub**: https://github.com/D4Vinci/Scrapling
**原文**: https://mp.weixin.qq.com/s/EwVItQH4JUsONqv_Fmi4wQ
**更新日期**: 2026-03-09

---

## 🎯 核心价值

实现**永久免费**的网页提取方案，支持：
- ✅ 微信公众号全文提取
- ✅ 绕过反爬机制
- ✅ 无使用次数限制
- ✅ 效果和Jina Reader相当

---

## 📦 安装步骤

### 方法1: Node.js版本（推荐，轻量易用）

```bash
# 1. 安装依赖
cd skills/scrapling-web-fetch
npm install axios cheerio --save

# 2. 将此Skill复制到OpenClaw skills目录
# 全局: ~/.openclaw/skills/scrapling-web-fetch
# 工作区: <project>/skills/scrapling-web-fetch
```

### 方法2: Python版本（如果系统有Python）

```bash
# 1. 安装依赖
pip install scrapling html2text requests beautifulsoup4

# 2. 将此Skill复制到OpenClaw skills目录
```

---

## 🚀 使用方法

### 命令行使用

```bash
# 基本使用
node scrapling-fetch.js https://example.com

# 指定最大字符数
node scrapling-fetch.js https://example.com 50000

# 微信公众号（直接用Scrapling）
node scrapling-fetch.js https://mp.weixin.qq.com/s/xxxxx
```

### OpenClaw中调用

```javascript
// 模块化调用
const { smartFetch } = require('./scrapling-fetch.js');

// 智能提取（自动选择最佳方案）
const result = await smartFetch('https://example.com', 30000);

if (result.success) {
    console.log(`标题: ${result.title}`);
    console.log(`内容: ${result.content}`);
} else {
    console.log(`错误: ${result.error}`);
}
```

---

## 💡 三种方案对比

| 方案 | 适用场景 | 优势 | 限制 |
|------|---------|------|------|
| **Jina Reader** | 英文博客、Substack、Medium | 速度快(1.4秒)、格式干净 | 200次/天限额 |
| **Scrapling** | 微信公众号、反爬平台 | 无限制、绕过反爬 | 速度约3秒 |
| **web_fetch** | 静态页面、GitHub | 最简单 | 全页噪音多 |

---

## 🤖 智能策略（自动选择）

脚本会自动按优先级选择方案：

```javascript
// 优先级1: 微信公众号 → 直接用Scrapling
if (url.includes('mp.weixin.qq.com')) {
    使用Scrapling
}

// 优先级2: 尝试Jina Reader
Jina Reader
→ 成功：返回结果
→ 失败：降级到Scrapling

// 优先级3: 使用Scrapling
Scrapling
```

---

## 🔥 典型使用场景

### 场景1: 微信公众号文章

```javascript
const result = await smartFetch(
    'https://mp.weixin.qq.com/s/EwVItQH4JUsONqv_Fmi4wQ',
    30000
);

// ✅ 直接获取全文，包括图片链接、链接引用
```

### 场景2: 英文博客

```javascript
const result = await smartFetch(
    'https://example.com/my-article',
    30000
);

// ✅ 优先使用Jina Reader（速度快）
```

### 场景3: 技术文档

```javascript
const result = await smartFetch(
    'https://docs.example.com/guide',
    30000
);

// ✅ 降级到Scrapling（保证成功）
```

---

## 📊 输出格式

```javascript
{
    success: true,
    title: "文章标题",
    content: "Markdown格式的内容\n包含链接和图片",
    url: "https://example.com",
    length: 15234,
    method: "jina-reader" // 或 "scrapling"
}
```

---

## 🎨 关键特性

### Scrapling优势
- ✅ 原生绕过反爬（Cloudflare Turnstile等）
- ✅ 自适应选择器（网站改版自动重新定位）
- ✅ 零依赖启动
- ✅ 无限制使用
- ✅ 效果和Jina相当

### Node.js实现优势
- ✅ 轻量级（无需Python）
- ✅ 兼容Windows
- ✅ 保留链接和图片
- ✅ 格式化输出

---

## 🛠️ 技术栈

- **axios**: HTTP请求
- **cheerio**: HTML解析（替代html2text）
- **Node.js**: 运行环境

---

## ⚙️ 配置选项

```javascript
const CONFIG = {
    maxChars: 30000,      // 最大字符数
    timeout: 30000,       // 超时时间（毫秒）
    userAgents: [...]     // 随机User-Agent池
};
```

---

## 📝 常见问题

### Q1: 为什么不用Jina Reader？
A: Jina每天只有200次免费限额，不够用。Scrapling无限制更可靠。

### Q2: 微信公众号为什么Jina报403？
A: 微信有专门的反爬机制，Scrapling的StealthyFetcher可以绕过。

### Q3: 速度怎么样？
A: Jina约1.4秒，Scrapling约3秒，都很快。

### Q4: 如何提取更多内容？
A: 增加maxChars参数，例如：`smartFetch(url, 50000)`

---

## 🎁 永久免费的关键

1. **Scrapling无限制** - 不需要API Key
2. **Jina备用** - 节省配额
3. **Node.js轻量** - 无需复杂环境

---

## 📚 参考链接

- [Scrapling GitHub](https://github.com/D4Vinci/Scrapling)
- [Jina Reader文档](https://jina.ai/reader)
- [原文文章](https://mp.weixin.qq.com/s/EwVItQH4JUsONqv_Fmi4wQ)
- [本文Node.js版本](https://github.com/你的名字/scrapling-web-fetch)

---

## 🚦 快速开始

```bash
# 1. 安装依赖
npm install axios cheerio --save

# 2. 运行示例
node scrapling-fetch.js https://example.com 30000

# 3. 在OpenClaw中调用
const { smartFetch } = require('./scrapling-fetch.js');
const result = await smartFetch('https://example.com');
```

---

**立即体验永久免费网页提取！** 🎉

