mcpField
W
web-monitor

web-monitor

github.com/rogue-agent1生产力056 次安装33 周前更新
代码仓库

关于 web-monitor

web-monitor 是用于跟踪网页变化的命令行技能,可保存快照并计算差异,也能通过 CSS 选择器监控页面特定区域。

主要功能

  1. 01监控 URL 并保存初始快照
  2. 02用 CSS 选择器监控页面区域
  3. 03检查单个或全部监控页面
  4. 04查看快照和记录的差异
  5. 05以 JSON 输出供程序检查

适用场景

  1. 01跟踪产品定价变化
  2. 02监控文章列表的新条目
  3. 03在定时运行中检查多个页面

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/rogue-agent1/web-monitor --skill web-monitor

安装后在 Claude Code 中输入/web-monitor确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

README.md
LICENSE
scripts/
monitor.py

详细介绍

网页监控器

跟踪网页变化。存储快照、计算差异,并支持 CSS 选择器。

快速开始

# Add a URL to watch
uv run --with beautifulsoup4 python scripts/monitor.py add "https://example.com" --name "Example"

# Add with CSS selector (monitor specific section)
uv run --with beautifulsoup4 python scripts/monitor.py add "https://example.com/pricing" -n "Pricing" -s ".pricing-table"

# Check all watched URLs for changes
uv run --with beautifulsoup4 python scripts/monitor.py check

# Check one specific URL
uv run --with beautifulsoup4 python scripts/monitor.py check "Example"

# List watched URLs
uv run --with beautifulsoup4 python scripts/monitor.py list

# View last diff
uv run --with beautifulsoup4 python scripts/monitor.py diff "Example"

# View current snapshot
uv run --with beautifulsoup4 python scripts/monitor.py snapshot "Example" --lines 50

# Remove
uv run --with beautifulsoup4 python scripts/monitor.py remove "Example"

命令

命令参数描述
add<url> [-n name] [-s selector]添加要监控的 URL,并获取初始快照
remove<url-or-name>停止监控某个 URL
list[-f json]列出所有受监控的 URL 及其统计信息
check[url-or-name] [-f json]检查是否有变化(全部或单个)
diff<url-or-name>显示最近记录的差异
snapshot<url-or-name> [-l lines]显示当前快照

输出符号

  • 🔔 CHANGED — 页面内容已变化(显示差异预览)
  • ✅ 没有变化
  • 📸 已获取初始快照
  • ❌ 获取失败

数据

存储在 ~/.web-monitor/ 中(可通过 WEB_MONITOR_DIR 环境变量覆盖):

  • watches.json — 监控列表配置
  • snapshots/ — 存储的页面内容和差异

提示

  • 使用 --selector 监控特定元素(价格、文章列表等)
  • 使用 --format json 进行程序化检查(心跳集成)
  • CSS 选择器需要 beautifulsoup4(通过 --with 标志包含)
  • 对文本进行规范化,以减少时间戳、空白字符和广告造成的干扰

评论

支持 Markdown