当前位置: 首页 > Skill >

Web Content Fetcher (WeChat images fix)

Web Content Fetcher (WeChat images fix)

0.0.1 2026.11.06 浏览:734
获取Skill文件查看使用说明
作者:陈宁许可证:
本文目录展开

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.

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,049
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,038
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,027
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,026
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,024
PHP集成RabbitMQ实现消息队列的完整步骤

使用 php-amqplib 库,通过建立连接、声明交换机与队列并绑定,即可在 PHP 中实现消息的发送与消费。

2026.05.24 1,020
Skill 文件
  • SKILL.md
    • Web Content Fetcher
    • Extraction Strategy
      • Scrapling script
    • Domain Routing
    • Script Options
    • Install Dependencies
    • Failure Rules
    • WeChat-specific gotchas
  • 项目或源文件

相关 Skill

更多
Web Clipper Web Clipper 使用 Jina Reader API 将任意网页保存为干净的 Markdown 笔记(含元数据),以 Obsidian 格式组织,无需浏览器扩展。
Jina Reader Jina Reader 利用 Jina Reader API 从任意 URL 提取简洁、易读的 Markdown 内容。适用于抓取和解析网页,无需处理 HTML、JavaScript 渲染或付费墙。非常适合研究、文章摘要、内容分析以及处理 tavily-search、web_search 或 searxng 技能的搜索结果。
Safe Smart Web Fetch Safe Smart Web Fetch 安全网页抓取技能。先判断URL是否含token、内网/本地域名或私密链接,这些直接抓取;其余公开网页依次尝试Jina Reader、markdown.new、defuddle.md获取干净Markdown,失败回退原始抓取。
Jina Reader URL转Markdown转换器和网络搜索API Jina Reader URL转Markdown转换器和网络搜索API Jina Reader 通过在任何网页地址前缀 https://r.jina.ai/ 将任何 URL 转换为 LLM 友好的 markdown。它还在 https://s.jina.ai/ 提供搜索端点,以干净的 markdown 格式返回网络搜索结果,用于 RAG 和代理工作流。
Web Content Fetcher Web Content Fetcher 网页内容获取工具 | 当常规爬虫被过滤时,使用替代服务获取网页内容。支持:1) r.jina.ai - 最稳定 2) markdown.new - Cloudflare 专用 3) defuddle.md - 备用方案。触发词:获取网页内容、网页转markdown、内容抓取、fetch webpage、bypas...