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

@lyhue1991/webfetch

v0.1.0

Published

Fetch and convert web content to markdown, text, or html from the command line

Readme

webfetch

网页内容抓取工具,支持将网页转换为 Markdown、文本或 HTML 格式。可作为 CLI 工具或 OpenCode SKILL 使用。

安装

方式一:作为 SKILL 安装(推荐)

npx skills add lyhue1991/webfetch

方式二:作为 CLI 工具安装

# 使用 npx 直接运行
npx @lyhue1991/webfetch https://example.com

# 或全局安装
npm install -g @lyhue1991/webfetch
webfetch https://example.com

使用方法

webfetch <url> [options]

参数说明

| 参数 | 简写 | 说明 | 默认值 | |------|------|------|--------| | --format | -f | 输出格式:markdown, text, html | markdown | | --timeout | -t | 超时时间(秒),最大 120 | 30 | | --output | -o | 保存到指定文件 | - | | --quiet | -q | 静默模式,仅输出内容 | false | | --proxy | | 代理服务器地址 | - | | --insecure | | 跳过 TLS 证书验证 | false | | --help | -h | 显示帮助 | - | | --version | -v | 显示版本 | - |

示例

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

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

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

# 静默模式(适合管道)
webfetch https://example.com -q > content.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

代理支持

webfetch 自动读取环境变量代理配置:

  • HTTP_PROXY / http_proxy - HTTP 请求代理
  • HTTPS_PROXY / https_proxy - HTTPS 请求代理
  • NO_PROXY / no_proxy - 跳过代理的主机列表
# 通过环境变量设置代理
export HTTPS_PROXY=http://proxy.example.com:8080
webfetch https://example.com

# 命令行覆盖代理
webfetch https://example.com --proxy http://custom-proxy:8080

# 禁用本次请求的代理
webfetch https://example.com --proxy ""

# 处理代理证书问题
webfetch https://example.com --insecure

功能特性

  • 多格式输出 - 转换 HTML 为 Markdown(默认)、纯文本或保留原始 HTML
  • 智能内容处理 - 自动检测 Content-Type,正确处理非 HTML 响应
  • 反爬虫策略 - Chrome UA 伪装,Cloudflare 挑战自动重试
  • 安全限制 - 最大 5MB 响应限制,可配置超时
  • 清洁输出 - 移除 script、style 等非内容元素
  • 代理支持 - 自动环境变量检测,支持手动覆盖

退出码

| 代码 | 说明 | |------|------| | 0 | 成功 | | 1 | 用户错误(无效 URL、参数错误) | | 2 | 网络错误(超时、DNS 解析失败) | | 3 | 服务器错误(4xx、5xx 响应) |

系统要求

  • Node.js >= 18.0.0

许可证

MIT