npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@seepine/webfetch

v0.1.1

Published

A CLI tool to fetch web pages and convert them to markdown, text, or html

Readme

webfetch

抓取网页并转换为 Markdown / 纯文本 / HTML 的 CLI 工具。

功能特性

  • 多格式输出 — 一键转换为 Markdown(默认)、纯文本或保留原始 HTML
  • 快速抓取 — JSON / XML / Markdown 响应直接使用 Node fetch 返回原文,无需启动无头浏览器
  • JavaScript 渲染 — 基于无头浏览器,支持 SPA、懒加载、动态渲染页面
  • 智能内容提取 — 自动选取页面主体内容:main > article > #content > .content > body
  • 清洁输出 — 移除 script、style、noscript、iframe 及图片引用等非内容元素
  • 代理支持 — 自动读取环境变量代理配置,支持 --proxy 手动指定
  • 灵活超时 — 超时时间可配置(最大 120 秒),适配慢速站点
  • TLS 容错 — 可跳过证书校验,应对自签名证书场景

安装

A. agent skill

本仓库提供 skills/webfetch/SKILL.md,封装了 webfetch 的命令行用法,可直接用于 Claude Code、OpenCode、Cursor 等 AI 编程工具,方便 AI 代理抓取网页、网页转 Markdown 等场景。

npx -y skills add https://github.com/seepine/webfetch -g -y

B. cli

npm install -g @seepine/webfetch

要求 Node.js >= 22.12(由 puppeteer / commander 的最低版本决定)。

使用方法

webfetch <url> [options]

参数说明

| 参数 | 简写 | 说明 | 默认值 | | ------------ | ---- | --------------------------------------------- | ---------- | | --format | -f | 输出格式:markdown、text、html | markdown | | --timeout | -t | 超时时间(秒),最大 120 | 30 | | --output | -o | 保存到指定文件(无扩展名时自动补 .md) | - | | --proxy | | 代理服务器地址(优先级最高) | - | | --insecure | | 跳过 TLS 证书验证 | false | | --help | -h | 显示帮助 | - | | --version | -V | 显示版本 | - |

示例

# 抓取并转换为 Markdown(默认)
webfetch "https://example.com"

# 输出纯文本
webfetch "https://example.com" -f text

# 输出原始 HTML
webfetch "https://example.com" -f html

# 保存到文件
webfetch "https://example.com" -o output.md

# 自定义超时
webfetch "https://example.com" --timeout 60

# 使用代理
webfetch "https://example.com" --proxy http://proxy:8080

# 跳过证书验证(自签名证书场景)
webfetch "https://example.com" --insecure

# 抓取文章并保存
webfetch "https://example.com/article" -o article.md

代理配置

当网络环境需要代理时,有两种方式:

方式一:环境变量(推荐)

export HTTPS_PROXY=http://proxy:8080
webfetch "https://example.com"

方式二:命令行参数(优先级最高)

webfetch "https://example.com" --proxy http://proxy:8080

环境变量

| 变量 | 说明 | | ------------- | ------------------ | | HTTP_PROXY | HTTP 请求代理 | | HTTPS_PROXY | HTTPS 请求代理 | | NO_PROXY | 跳过代理的主机列表 |

开发

pnpm cli       # 直接运行 CLI(tsx 执行 TypeScript)
pnpm build     # 构建发布版本(tsdown + chmod)
pnpm check     # 格式检查 + 类型检查
pnpm tsc       # 类型检查(不生成文件)
pnpm format    # 使用 Prettier 格式化代码

许可证

MIT