agentleFS
guihai24guihai24/openskills/skills/smart-fetch/SKILL.md

smart-fetch

Skill2 starsChanged 4 months agoMITView on GitHub

智能网页抓取路由。拿到任意 URL,自动选择最合适的工具抓取内容,无需试错。 触发场景:抓取网页、读取文章、获取推文、访问公开页面、提取 URL 内容。 零依赖,无需 Chrome/CDP,适合服务器和无头环境。

The file

Files
SKILL.md

smart-fetch — 智能网页抓取路由

拿到 URL,按场景自动选择最合适的工具,不试错,5 秒出结果。

路由规则(按优先级执行)

优先级场景判断条件工具
1推文 / XURL 含 x.com 或 twitter.comJina + curl
2文章 / 博客 / 文档内容型页面(Medium、知乎、掘金、少数派、GitHub README、SubStack 等)Jina + WebFetch
3关键词搜索无具体 URL,需要发现信息WebSearch
4普通公开网页URL 已知,内容公开WebFetch
5需要原始 HTML需要 meta / JSON-LD / 结构化数据curl
6兜底前几步返回空或错误curl + 浏览器 UA

决策流程

  1. 拿到请求 — 明确目标:是 URL 还是关键词?要提取什么内容?
  2. 匹配路由 — 按上表优先级从高到低匹配场景,选第一个命中的工具
  3. 执行 — 调用对应工具
  4. 校验结果 — 返回内容是否有效?空内容 / 登录墙 / 报错 → 降级到下一个工具
  5. 全部失败 — 告知用户:该页面需要登录态或浏览器环境(CDP),建议使用 web-access skill

工具使用规范

Jina(首选预处理层)

将网页转为干净的 Markdown,大幅节省 token,适合正文提取。

调用方式:https://r.jina.ai/{原始完整URL}
示例:https://r.jina.ai/https://x.com/user/status/123
  • 速率限制:20 RPM
  • 适合:推文、文章、博客、文档、PDF
  • 不适合:数据面板、商品列表、需要登录的内容
  • 失败信号:返回 "Sign in" / "Log in" / 空内容 → 降级

使用 curl 调用 Jina:

curl -s "https://r.jina.ai/https://x.com/user/status/123" \
  -H "Accept: text/plain" \
  --max-time 30

使用 WebFetch 调用 Jina:

  • url: https://r.jina.ai/https://example.com/article
  • prompt: 描述要提取的内容

WebSearch

用于关键词搜索、发现信息来源。无具体 URL 时的第一选择。

WebFetch

已知 URL、内容公开时直接使用。由模型根据 prompt 提取内容,返回处理后结果。

curl

需要原始 HTML 或 Jina/WebFetch 均失败时使用。

curl -s "{URL}" \
  -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" \
  --max-time 30

站点经验

操作前先查 references/site-patterns.md,有命中站点则按已验证模式执行。

操作成功后,如发现新的有效模式或陷阱,主动更新 references/site-patterns.md。

边界说明

smart-fetch 覆盖零依赖的公开内容抓取。以下场景超出范围,建议使用 web-access skill:

  • 需要登录态的内容(小红书、微信公众号、付费内容)
  • 需要页面交互(点击、滚动、填表)
  • 反爬强的平台(多次降级后仍失败)
  • 需要 JS 渲染的动态页面

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.