web-content-fetcher by shirenchuang/web-content-fetcher
npx skills add https://github.com/shirenchuang/web-content-fetcher --skill web-content-fetcher给定一个 URL,将其主要内容以纯净的 Markdown 格式返回——标题、链接、图片、列表、代码块等均被保留。
始终尝试 每个 URL 使用一种方法——不要盲目级联。预先选择正确的方法。
URL
│
├─ 1. Scrapling 脚本(首选)
│ 运行 fetch.py —— 检查域名路由表以决定使用快速模式还是 --stealth 模式。
│ 适用于大多数网站。直接返回纯净的 Markdown。
│
└─ 2. Jina Reader(备用方案——仅在 Scrapling 失败或依赖未安装时使用)
web_fetch("https://r.jina.ai/<url>")
免费层级:200 次请求/天。速度快(约 1-2 秒),Markdown 输出质量好。
不适用于:微信(403)、部分中国平台。
python3 <SKILL_DIR>/scripts/fetch.py "<url>" [max_chars] [--stealth]
<SKILL_DIR> 是此 SKILL.md 文件所在的目录。在调用脚本前请先解析其路径。
该脚本内置两种模式:
--stealth: 无头浏览器模式,约 5-15 秒,适用于 JS 渲染或反爬虫网站当不带 --stealth 参数运行时,如果快速模式获取的内容过少,脚本会自动回退到 stealth 模式。因此你很少需要手动指定 ——唯一需要强制使用的情况是你已经知道该网站需要此模式(参见路由表),这样可以节省初始的快速尝试。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
--stealth首次调用时使用此表选择正确的模式:
| 域名 | 命令 | 原因 |
|---|---|---|
mp.weixin.qq.com | fetch.py <url> --stealth | JS 渲染的内容 |
zhuanlan.zhihu.com | fetch.py <url> --stealth | 反爬虫 + JS |
juejin.cn | fetch.py <url> --stealth | JS 渲染的 SPA |
sspai.com | fetch.py <url> | 静态 HTML |
blog.csdn.net | fetch.py <url> | 静态 HTML |
ruanyifeng.com | fetch.py <url> | 静态博客 |
openai.com | fetch.py <url> | 静态 HTML |
blog.google | fetch.py <url> | 静态 HTML |
| 其他所有域名 | fetch.py <url> | 自动回退机制会处理 |
# 基本用法 —— 自动选择快速或 stealth 模式
python3 <SKILL_DIR>/scripts/fetch.py "https://sspai.com/post/73145"
# 为已知的 JS 密集型网站强制使用 stealth 模式
python3 <SKILL_DIR>/scripts/fetch.py "https://mp.weixin.qq.com/s/xxx" --stealth
# 将输出限制在 15000 个字符以内(默认:30000)
python3 <SKILL_DIR>/scripts/fetch.py "https://example.com/article" 15000
# 输出包含元数据(url、mode、selector、content_length)的 JSON
python3 <SKILL_DIR>/scripts/fetch.py "https://example.com" --json
仅首次使用时需要——脚本会检查并告知你是否缺少任何依赖:
pip install scrapling html2text
如果使用的是系统管理的 Python(macOS/Linux),请添加 --break-system-packages 或使用虚拟环境。
每周安装量
1.1K
代码仓库
GitHub 星标数
460
首次出现
2026年3月9日
安全审计
安装于
opencode1.0K
codex1.0K
gemini-cli1.0K
kimi-cli1.0K
github-copilot1.0K
cursor1.0K
Given a URL, return its main content as clean Markdown — headings, links, images, lists, code blocks all preserved.
Always try one method per URL — don't cascade blindly. Pick the right one upfront.
URL
│
├─ 1. Scrapling script (preferred)
│ Run fetch.py — check the domain routing table to decide fast vs --stealth.
│ Works for most sites. Returns clean Markdown directly.
│
└─ 2. Jina Reader (fallback — only if Scrapling fails or dependencies not installed)
web_fetch("https://r.jina.ai/<url>")
Free tier: 200 req/day. Fast (~1-2s), good Markdown output.
Does NOT work for: WeChat (403), some Chinese platforms.
python3 <SKILL_DIR>/scripts/fetch.py "<url>" [max_chars] [--stealth]
<SKILL_DIR> is the directory where this SKILL.md lives. Resolve it before calling the script.
The script has two modes built in:
--stealth: Headless browser, ~5-15s, for JS-rendered or anti-scraping sitesWhen run without --stealth, the script automatically falls back to stealth if the fast result has too little content. So you rarely need to specify --stealth manually — the only reason to force it is when you already know the site needs it (see routing table), which saves the initial fast attempt.
Use this table to pick the right mode on the first call:
| Domain | Command | Why |
|---|---|---|
mp.weixin.qq.com | fetch.py <url> --stealth | JS-rendered content |
zhuanlan.zhihu.com | fetch.py <url> --stealth | Anti-scraping + JS |
juejin.cn | fetch.py <url> --stealth | JS-rendered SPA |
sspai.com |
# Basic — auto-selects fast or stealth
python3 <SKILL_DIR>/scripts/fetch.py "https://sspai.com/post/73145"
# Force stealth for known JS-heavy sites
python3 <SKILL_DIR>/scripts/fetch.py "https://mp.weixin.qq.com/s/xxx" --stealth
# Limit output to 15000 characters (default: 30000)
python3 <SKILL_DIR>/scripts/fetch.py "https://example.com/article" 15000
# JSON output with metadata (url, mode, selector, content_length)
python3 <SKILL_DIR>/scripts/fetch.py "https://example.com" --json
First use only — the script checks and tells you if anything is missing:
pip install scrapling html2text
If on system-managed Python (macOS/Linux), add --break-system-packages or use a venv.
Weekly Installs
1.1K
Repository
GitHub Stars
460
First Seen
Mar 9, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode1.0K
codex1.0K
gemini-cli1.0K
kimi-cli1.0K
github-copilot1.0K
cursor1.0K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
fetch.py <url> |
| Static HTML |
blog.csdn.net | fetch.py <url> | Static HTML |
ruanyifeng.com | fetch.py <url> | Static blog |
openai.com | fetch.py <url> | Static HTML |
blog.google | fetch.py <url> | Static HTML |
| Everything else | fetch.py <url> | Auto-fallback handles it |