with one click
web-fetch
万能网页抓取工具,支持多种策略绕过反爬虫检测。触发词:抓取网页、获取网页内容、scrape。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
万能网页抓取工具,支持多种策略绕过反爬虫检测。触发词:抓取网页、获取网页内容、scrape。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
PRD 驱动的完整开发工作流 - 从用户故事分析到自动化测试的端到端流程。 当用户需要"一条龙开发"、"全自动开发"、"从需求到代码"、"先分析PRD再开发"、 "多模型分析后自动开发"、"完整开发流程"、"从需求分析到测试"或任何涉及 PRD分析→需求整合→代码生成→自动化测试的连续工作时,**必须**使用此技能。 整合多模型聚合、Kimi深度整合、PRD生成、多模型代码审查、代码开发、自动化测试等能力。 **新增**: 智能决策大脑(th-workflow-decision-engine) - 自动判断何时使用GitNexus代码分析、 unified-search联网搜索、多模型聚合,测试失败时智能选择修复策略。
PRD驱动工作流的决策大脑 - 智能判断何时使用搜索、代码分析、多模型聚合。 作为子Skill被 th-prd-driven-dev-workflow 调用,负责工具选择和策略决策。
动态 Agent 生成器(母体模式)。当用户需要处理复杂项目时,自动分析需求并生成定制化专业 Agent 团队。接收项目描述、技术栈、版本号、约束条件,输出完整的 Agent 配置和启动命令。触发词:需要专业团队、生成 Agent、创建定制化 Agent、复杂项目团队、动态生成 Agent。
Arch Linux 系统特性(PEP 668、AUR Helpers)
浏览器交互自动化:网页测试、表单填写、截图、数据提取。触发词:打开网页、填写表单、网页截图。
系统化代码审查:安全性、性能、可维护性、正确性、测试覆盖。触发词:代码审查、review 代码、PR 审查。
| name | web-fetch |
| description | 万能网页抓取工具,支持多种策略绕过反爬虫检测。触发词:抓取网页、获取网页内容、scrape。 |
| version | 1 |
版本: v1.0 创建日期: 2026-03-15
核心优势: 多策略自动切换,从轻量到重量级,智能选择最优方案
统一网页抓取工具,支持 4 种抓取策略:
| 方法 | 速度 | 适用场景 | 反爬虫绕过 |
|---|---|---|---|
| curl | ⚡ 最快 | 静态 HTML | ❌ 无 |
| agent-browser | 🚀 快 | 动态 SPA | ✅ 中等 |
| browser-use | 🐢 中 | 复杂交互 | ✅ 强 |
| playwright | 🐌 慢 | 强反爬虫 | ✅✅ 最强 |
自动模式: 从 curl 开始,失败后自动尝试更强的方法
# 基础使用(自动模式)
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://example.com"
# 指定方法
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://example.com" --method browser-use
# 带截图
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://example.com" --screenshot out.png
# JSON 输出
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://example.com" --json
| 参数 | 说明 | 默认值 |
|---|---|---|
--method METHOD | 抓取方法:auto, curl, playwright, all | auto |
--timeout MS | 超时时间(毫秒) | 30000 |
--retry / --no-retry | 是否启用重试 | true |
--output FILE | 保存内容到文件 | - |
--screenshot FILE | 保存截图 | - |
--wait N | 等待 N 秒后获取 | 0 |
--ua UA | 自定义 User-Agent | 随机 |
--json | JSON 输出格式 | false |
--stats | 显示统计报告 | false |
# 获取 GitHub README
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://github.com/anthropics/claude-code"
# 获取新闻文章
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://example.com/article/123" --output article.html
# React/Vue 应用,等待 3 秒让 JS 执行
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://app.example.com" --wait 3 --method playwright
# 获取页面并截图
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://example.com" --screenshot page.png
# 强反爬虫网站,使用 Playwright
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://protected-site.com" --method playwright
# 或者使用 browser-use(带浏览器指纹)
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://cloudflare-protected.com" --method browser-use
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://api.example.com" --json | jq '.content'
用户请求
↓
auto 模式?
├─ 是 → 尝试 curl → 失败 → playwright
└─ 否 → 直接使用指定方法
↓
获取成功?
├─ 是 → 输出结果
└─ 否 → 重试(最多 3 次,指数退避)
# 优点
✅ 最快(~1 秒)
✅ 无需浏览器
✅ 低资源占用
# 缺点
❌ 无法执行 JS
❌ 无法绕过反爬虫
# 优点
✅ 最强反爬虫绕过
✅ 完整浏览器功能
✅ Stealth 模式隐藏特征
# 缺点
❌ 最慢(~10-20 秒)
❌ 需要安装 playwright
# 设置默认 User-Agent
export WEB_FETCH_UA="Mozilla/5.0 ..."
# 设置默认超时
export WEB_FETCH_TIMEOUT=60000
# 设置默认方法
export WEB_FETCH_METHOD=browser-use
# Cookies 自动保存在 cookies.txt
# 多次请求会自动复用登录状态
# 测试 curl 方法
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://example.com" --method curl
# 测试 agent-browser
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://example.com" --method agent-browser
# 测试 browser-use
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://example.com" --method browser-use
# 测试 playwright
node ~/src/user-scripts/skills/web-fetch/scripts/fetch-page.mjs "https://example.com" --method playwright
# 检查网络连接
curl -I https://example.com
# 检查是否被防火墙阻挡
ping example.com
# 尝试更换 User-Agent
node fetch-page.mjs "url" --ua "Mozilla/5.0 ..."
# 可能是动态内容,增加等待时间
node fetch-page.mjs "url" --wait 5
# 或者使用浏览器方法
node fetch-page.mjs "url" --method browser-use
# 使用最强方法
node fetch-page.mjs "url" --method playwright
# 或者使用 browser-use 的 real 浏览器模式
browser-use --browser real open "url"
# 方法 1:先手动登录,保存 cookies
browser-use --browser real open "https://example.com/login"
# ... 手动登录 ...
browser-use cookies export cookies.json
# 方法 2:使用 browser-use 的 profile
browser-use --browser real --profile "Default" open "https://example.com"
## 网页内容
**URL**: https://example.com
**标题**: Example Domain
**方法**: curl
**耗时**: 1.23s
---
[网页 HTML 内容]
{
"success": true,
"url": "https://example.com",
"title": "Example Domain",
"method": "curl",
"content": "<html>...",
"elapsed": 1234
}
# 基础依赖(curl 方法)
sudo pacman -S curl
# playwright 方法
cd ~/src/user-scripts/skills/web-fetch
npm install playwright puppeteer-extra puppeteer-extra-plugin-stealth
npx playwright install chromium
| 方法 | 平均耗时 | 成功率 | 资源占用 |
|---|---|---|---|
| curl | ~1s | 60% | 低 |
| playwright | ~5-30s | 95% | 高 |
触发此 skill 时,任务完成必须满足:
最后更新:2026-03-15 | 维护:~/src/user-scripts/skills/web-fetch/