微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🌐

一键提取网页正文为 Markdown

Web Content Fetcher (WeChat images fix) · v0.0.1
效率 安全 B 级 作者 haanya168 公开目录收录
下载 1.3k 安装 1 收藏 4.2k 浏览 20
原始页面

简介

智能网页内容提取器,支持动态渲染站点,一键将任意 URL 转换为干净 Markdown,保留完整排版结构

原始描述

Extract article content from any URL as clean Markdown. Uses Scrapling script as primary method (with auto fast→stealth fallback), Jina Reader as alternative...

中文使用说明 来自收录源

核心用法

Web Content Fetcher 是一款专为内容提取设计的自动化技能,可将任意网页 URL 转换为结构清晰的 Markdown 格式。其核心采用双引擎架构:主引擎为 Scrapling 脚本(支持 HTTP 快速抓取与无头浏览器隐身模式自动切换),备选引擎为 Jina Reader API。用户仅需提供目标 URL,系统即可自动识别站点特征,选择最优提取策略。

典型调用场景:

  • 阅读微信公众号文章(mp.weixin.qq.com)
  • 提取知乎专栏、掘金等技术社区内容
  • 抓取 CSDN、少数派等静态博客文章
  • 快速获取任意文档页面的正文内容

显著优点

  1. 智能路由决策:内置域名路由表自动匹配提取模式,针对微信公众号、知乎、掘金等 JS 渲染站点强制启用隐身模式,静态站点则使用快速 HTTP 抓取,兼顾效率与成功率。

  2. 自动降级机制:Scrapling 脚本内置内容质量检测,快速模式若返回内容过少则自动切换至隐身模式,无需用户手动干预。

  3. 格式完整性保障:完整保留标题层级、超链接、图片、列表及代码块,WeChat _lazy-load 图片自动还原真实 URL。

  4. 多输出选项:支持字符长度限制(默认 30000)、JSON 元数据输出等灵活配置。

潜在缺点与局限性

  • Jina Reader 限制:免费额度 200 次/日,且对微信公众号等平台返回 403 错误,无法作为通用 fallback
  • 依赖管理:首次使用需手动安装 scrapling + html2text,系统级 Python 环境可能需额外参数
  • 失败即终止策略:同一 URL 失败一次后不再重试,对临时性网络波动敏感
  • 图片本地化缺失:默认仅提取远程 URL,若需离线副本需额外开发后处理步骤

适合人群

  • 研究人员与知识工作者:需要批量归档网络文章、构建个人知识库
  • 开发者与技术写作者:快速提取技术文档、教程用于引用或改写
  • 内容运营人员:监控竞品公众号、专栏更新,实现自动化内容采集

常规风险

  • 合规风险:抓取行为需遵守目标站点 robots.txt 及版权声明,微信公众号等内容受平台保护
  • 反爬对抗:部分站点可能更新反爬策略,导致路由表失效需人工维护
  • 内容完整性:极端复杂的单页应用(SPA)或高度自定义渲染逻辑可能超出自动检测能力
  • 隐私泄露:提取的页面可能包含用户个性化内容(如登录后的推荐信息),需注意脱敏处理

技能正文


name: web-content-fetcher description: > Extract article content from any URL as clean Markdown. Uses Scrapling script as primary method (with auto fast→stealth fallback), Jina Reader as alternative for simple pages. Preserves headings, links, images, lists, and code blocks. Use this skill whenever the user wants to fetch, read, extract, scrape, or summarize content from a URL — including blog posts, news articles, WeChat articles (微信公众号), documentation pages, or any web page. Also trigger when the user says things like "帮我读一下这篇文章", "抓取这个网页", "提取正文", or "read this page for me".

Web Content Fetcher

Given a URL, return its main content as clean Markdown — headings, links, images, lists, code blocks all preserved.

Note: This skill extracts content + remote image URLs. If the user wants an "offline" copy (download images to local disk and rewrite links), add a post-processing step (not included by default in this skill).

Extraction Strategy

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.

Scrapling script

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:

  • Default (fast): HTTP fetch, ~1-3s, works for most sites
  • --stealth: Headless browser, ~5-15s, for JS-rendered or anti-scraping sites

When 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.

Domain Routing

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 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

Script Options

# 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

Install Dependencies

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.

Failure Rules

  • Same URL fails once → give up, tell the user "unable to extract content from this URL"
  • Do not retry — each failed call wastes context tokens

WeChat-specific gotchas

  • WeChat often uses lazy-loaded images where the real URL is in data-src and src is a tiny placeholder.
  • The extractor script normalizes these to real src URLs before running html2text.
  • If you ever see Markdown image lines that contain weird URL-encoded SVG fragments (e.g. ...%3Csvg...%3E) appended after the closing ) of an image, it means the placeholder leaked into Markdown parsing; update fix_lazy_images() in scripts/fetch.py to remove/replace placeholder data:image/svg+xml src values.

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

web-scrapingmarkdowncontent-extractionreadabilityautomationwechatzhihu

同类 Skill