当前位置: 首页 > Skill >

web-to-markdown

web-to-markdown

web-to-markdown

网页内容抓取与图片提取技能。支持:(1) 将网页转换为 Markdown 格式阅读 (2) 从任意网站提取图片 URL (3) 批量下载网页图片。当需要抓取网页内容、读取文章、提取或下载网站图片时使用此技能。支持 markdown.new、defuddle.md、r.jina.ai 等转换服务,自动降级确保成功。...

1.0.0 2026.11.14 378
获取Skill文件查看使用说明
作 者:林川 许可证: 更新时间:2026.11.14
本文目录展开

Web to Markdown

概述 / Overview

通用网页抓取工具,支持: A general-purpose web scraping tool that supports:

  • 将网页内容转换为干净的 Markdown / Converting web content to clean Markdown
  • 从任意网站提取图片 URL / Extracting image URLs from any website
  • 批量下载网页图片 / Batch downloading images from web pages

适用于内容阅读、图片收集、资料整理等场景。 Suitable for content reading, image collection, and data organization.

功能模块 / Features

1. 网页转 Markdown / Web to Markdown

将网页 URL 转换为干净的 Markdown 文本,移除广告、导航栏等无关内容。 Converts a web page URL into clean Markdown text, removing ads, navigation bars, and other irrelevant content.

URL 前缀服务 / URL Prefix Services:

服务 Service 前缀 Prefix 特点 Notes
markdown.new https://markdown.new/ 首选,速度快 / Preferred, fast
defuddle https://defuddle.md/ 备选 / Fallback
r.jina.ai https://r.jina.ai/ 适合动态内容 / Good for dynamic content

使用 / Usage:

curl -s "https://markdown.new/https://example.com/article"
curl -s "https://r.jina.ai/https://example.com/article"

2. 提取网页图片 / Extract Images from Web Pages

从任意网页提取所有图片 URL。 Extracts all image URLs from any web page.

通用提取 / General Extraction:

# 提取所有图片 URL / Extract all image URLs
curl -s "https://r.jina.ai/<url>" | grep -oE 'https://[^)s"]+.(jpg|jpeg|png|gif|webp|avif)'

使用脚本 / Using the Script:

python scripts/extract_images.py <url> [--output urls.txt]

3. 批量下载图片 / Batch Download Images

从网页提取图片并批量下载到本地。 Extracts images from web pages and downloads them in batch to local storage.

使用脚本 / Using the Script:

python scripts/download_images.py <url> [--output <dir>] [--limit <n>] [--min-size <bytes>]

参数 / Parameters:

  • url: 网页 URL / Web page URL
  • --output: 输出目录(默认 ~/.openclaw/images)/ Output directory (default: ~/.openclaw/images)
  • --limit: 最大下载数(默认 50)/ Max downloads (default: 50)
  • --min-size: 最小文件大小,过滤小图标(默认 10KB)/ Min file size to filter out small icons (default: 10KB)
  • --ext: 只下载指定格式(jpg/png/gif/webp)/ Only download specific formats (jpg/png/gif/webp)

示例 / Examples:

# 下载网页中的所有大图 / Download all large images from a page
python scripts/download_images.py "https://example.com/gallery" --output ~/Downloads/images

# 只下载 PNG,最多 20 张 / Download only PNGs, max 20
python scripts/download_images.py "https://example.com" --ext png --limit 20

# Pinterest(自动转换原始尺寸)/ Pinterest (auto-converts to original size)
python scripts/download_images.py "https://www.pinterest.com/search/pins/?q=architecture"

工作流程 / Workflow

网页内容抓取 / Web Content Scraping

  1. 首选 markdown.new/ / Prefer markdown.new/
  2. 失败则尝试 defuddle.md/ / Fall back to defuddle.md/
  3. 再失败尝试 r.jina.ai/ / Then try r.jina.ai/
  4. 最终使用本地 Scrapling 脚本 / Finally use local Scrapling script

图片提取下载 / Image Extraction & Download

  1. 使用 r.jina.ai 获取网页内容 / Use r.jina.ai to fetch page content
  2. 正则提取所有图片 URL / Extract all image URLs via regex
  3. 过滤小图片(图标、表情等)/ Filter out small images (icons, emojis, etc.)
  4. 智能命名并下载保存 / Smart naming and download

特殊网站支持 / Special Website Support

Pinterest

自动识别 Pinterest URL,将缩略图转换为原始尺寸: Automatically detects Pinterest URLs and converts thumbnails to original size:

  • 236x → originals
  • 564x → originals

其他常见网站 / Other Common Websites

脚本会自动处理各种网站的图片 URL 格式,包括: The scripts automatically handle various image URL formats, including:

  • CDN 链接 / CDN links
  • 带参数的 URL / URLs with query parameters
  • 懒加载图片 / Lazy-loaded images

脚本说明 / Script Reference

scripts/scrape.py

本地网页抓取脚本,作为在线服务的降级方案。 Local web scraping script, used as a fallback for online services.

python scripts/scrape.py <url>

scripts/extract_images.py

提取网页中的图片 URL,输出为列表。 Extracts image URLs from a web page and outputs them as a list.

python scripts/extract_images.py <url> [--output urls.txt]

scripts/download_images.py

批量下载网页图片。 Batch downloads images from a web page.

python scripts/download_images.py <url> [options]

依赖 / Dependencies

extract_images.py 和 download_images.py 仅使用 Python 标准库,无需额外安装。 extract_images.py and download_images.py only use the Python standard library — no extra installation needed.

scrape.py 需要安装 scrapling(本地抓取降级方案): scrape.py requires scrapling (local scraping fallback):

pip install scrapling

注意事项 / Notes

  • 遵守网站的 robots.txt 和使用条款 / Respect the website's robots.txt and terms of use
  • 大量下载前考虑网站服务器压力 / Consider server load before mass downloading
  • 部分网站有防盗链,可能无法直接下载 / Some sites have hotlink protection and may block direct downloads
  • 动态加载的图片可能需要使用 r.jina.ai / Dynamically loaded images may require r.jina.ai

推荐文章

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

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

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

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

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

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

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

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

2025.04.29 1,017
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

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

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

2026.09.07 1,013
Skill 文件
  • SKILL.md
    • Web to Markdown
    • 概述 / Overview
    • 功能模块 / Features
      • 1. 网页转 Markdown / Web to Markdown
      • 2. 提取网页图片 / Extract Images from Web Pages
      • 3. 批量下载图片 / Batch Download Images
    • 工作流程 / Workflow
      • 网页内容抓取 / Web Content Scraping
      • 图片提取下载 / Image Extraction & Download
    • 特殊网站支持 / Special Website Support
      • Pinterest
      • 其他常见网站 / Other Common Websites
    • 脚本说明 / Script Reference
      • scripts/scrape.py
      • scripts/extract_images.py
      • scripts/download_images.py
    • 依赖 / Dependencies
    • 注意事项 / Notes
  • 项目或源文件

相关 Skill

更多
markdown.new markdown.new 使用 `https://markdown.new/{target_url}` 格式的链接获取页面并将其转换为静态 Markdown。当用户请求时触发此技能。
Safe Smart Web Fetch Safe Smart Web Fetch 安全网页抓取技能。先判断URL是否含token、内网/本地域名或私密链接,这些直接抓取;其余公开网页依次尝试Jina Reader、markdown.new、defuddle.md获取干净Markdown,失败回退原始抓取。
markdown-extract markdown-extract 通过 markdown.new API,使用自动、AI 或浏览器模式从任意 URL 提取纯 Markdown,支持错误处理及灵活提取选项。
sawana-multicul/official-docs-to-mdx sawana-multicul/official-docs-to-mdx 使用 markdown.new 将官方文档页面下载并规范化为本地 .mdx 文件,存放在用户指定的路径。当用户请求获取文档时使用。
Markdown Fetcher Markdown Fetcher 将网页内容转换为 Markdown 格式。 当需要获取网页内容并转换为可读 Markdown 时使用此 Skill。 优先级:markdown.new > defuddle.md > r.jina.ai > Scrapling