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

精准抓取网页,一键转Markdown

Web Fetch · v1.0.0
效率 安全 A 级 作者 shikamaru-cc 公开目录收录
974 下载 0 安装 3k 收藏 34 浏览

简介

本地Node.js工具,通过已知URL获取网页内容并转换为Markdown、纯文本或原始HTML,支持图片下载。适合文档抓取、内容摘要和页面结构分析。

原始描述

Fetch a known URL and return the page as markdown, plain text, raw HTML, or a downloaded image file using the local fetch.js helper. Use this whenever the us...

通过你的 Agent 添加

安装目录:web-fetch/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/web-fetch-54472/
Codex CLI~/.codex/skills/web-fetch-54472/
DeepSeek Harness~/.agents/skills/web-fetch-54472/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

web-fetch是一个基于Node.js的本地网页抓取工具,用于通过已知URL直接获取目标页面内容。与搜索类工具不同,它专注于定向检索而非内容发现。典型场景包括:抓取用户提供的文档链接、将文章转换为可读的Markdown格式后摘要、检查原始HTML结构,或直接下载远程图片到本地路径。

运行命令为node ./fetch.js --url "目标地址",支持四种输出格式:

  • markdown(默认):提取可读性强的格式化文本,适合文档和文章摘要
  • text:最纯净的纯文本提取,去除所有标记
  • html:保留原始标记语言,用于调试页面结构、元数据或嵌入内容
  • 图片下载:通过--output <路径>将远程图片保存到指定位置

可选参数包括--timeout(默认30秒,最大120秒)和--output(用于图片保存)。

显著优点

  1. 多格式输出灵活:同一URL可按需获取结构化Markdown、纯净文本或原始HTML,适应不同下游处理场景
  2. 智能容错机制:自动将HTTP尝试升级为HTTPS,内置Cloudflare 403挑战的浏览器级重试逻辑
  3. 资源管控严格:5MB响应上限和120秒超时限制防止资源滥用,适合自动化工作流嵌入
  4. 本地执行可信:基于Node.js本地脚本运行,无需依赖外部API服务,降低第三方数据泄露风险

潜在缺点与局限性

  • 无发现能力:必须提供确切URL,无法处理"查找某类内容"的需求,需配合搜索工具使用
  • 动态内容受限:对于重度JavaScript渲染的单页应用(SPA)或需要登录态的内容,抓取效果有限
  • 反爬防御敏感:虽有一定重试逻辑,但面对严格的WAF或速率限制时仍可能失败
  • SVG处理特殊:SVG被当作文本而非二进制图片处理,特定场景需额外转换

适合人群

  • 开发者与运维人员:需要批量抓取文档、检查页面元数据或调试HTML结构
  • 内容研究者:将网络文章转为可分析的Markdown文本进行摘要或知识整理
  • 自动化流程构建者:在CI/CD或数据处理管道中嵌入网页内容获取环节

常规风险

  1. 目标服务器负载:高频调用可能对目标站点造成压力,建议控制请求频率
  2. 内容版权合规:抓取受版权保护的文章或图片需确保符合使用条款及当地法规
  3. 敏感信息暴露:HTML源可能包含内嵌的API密钥、测试数据等,处理时需脱敏审查
  4. 链接失效风险:远程图片下载后原链接变更不影响本地文件,但需管理本地存储路径

技能正文


name: web-fetch description: Fetch a known URL and return the page as markdown, plain text, raw HTML, or a downloaded image file using the local fetch.js helper. Use this whenever the user gives or implies a specific URL and wants you to retrieve, inspect, quote, summarize, convert, or save that page or asset. Prefer this skill over web-search when discovery is not needed, including for docs pages, blog posts, raw HTML inspection, and direct image downloads. compatibility: opencode metadata: runtime: node transport: fetch

Web Fetch

Use this skill when the target URL is already known and the job is retrieval, not search.

Common cases:

  • fetch a documentation page the user already linked
  • pull an article into readable markdown or plain text before summarizing it
  • inspect raw HTML to debug markup, metadata, or page structure
  • download a remote image to a local path for later inspection or processing

If the user needs help finding the right page first, use web-search before this skill.

Command

Run:

node ./fetch.js --url "https://example.com"

Optional flags:

  • --format markdown|text|html
  • --timeout <seconds>
  • --output <path> for image responses

Choose the right format

Default to markdown unless the user clearly wants something else.

  • markdown: best for readable docs, articles, and summarization
  • text: best when the user wants the cleanest plain-text extraction
  • html: best when inspecting source markup, metadata, links, embeds, or page structure
  • --output <path>: use when the response is an image and you want a stable saved file path instead of a temp file

Examples:

node ./fetch.js --url "https://example.com/docs" --format markdown
node ./fetch.js --url "https://example.com/page" --format text --timeout 20
node ./fetch.js --url "https://example.com/page" --format html
node ./fetch.js --url "https://example.com/logo.png" --output /tmp/logo.png

How to work with the result

The CLI prints a <web_fetch> block.

For text-like responses it includes:

  • title
  • url
  • mime
  • format
  • content

For image responses it includes:

  • title
  • url
  • mime
  • image

After fetching:

  1. Read the returned fields carefully.
  2. Use only the parts relevant to the user's request.
  3. Summarize or quote concise excerpts instead of dumping the whole page unless the user asked for the full content.
  4. If you fetched HTML, explain notable structure or metadata rather than pasting large raw blobs unless needed.
  5. If you downloaded an image, tell the user the saved file path.

Behavior and limits

Keep these in mind while using the tool:

  • http:// URLs are tried as https:// first, then retried as plain HTTP if needed.
  • Default timeout is 30 seconds; maximum is 120 seconds.
  • Responses larger than 5MB are rejected.
  • Browser-like headers are used, with a retry path for some Cloudflare 403 challenge responses.
  • SVG is treated as text, not as a binary image attachment.

Failure handling

If the fetch fails:

  • verify the URL is complete and starts with http:// or https://
  • retry with a different format only if the user's goal changed
  • if the page is too large, blocked, or times out, tell the user plainly and suggest a narrower target URL or an alternate source

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

标签

web-scrapingmarkdown-conversioncontent-extractionurl-fetchinghtml-parserautomationnode-jscli-tool

同类 Skill