我为任意网站构建了“git log”——通过 diffs 和 AI 摘要跟踪更改

发布: (2026年3月14日 GMT+8 15:07)
2 分钟阅读
原文: Dev.to

Source: Dev.to

介绍

网站经常会变动——定价页面、文档、服务条款。我想要一个简单的 CLI 来告诉我哪些内容发生了变化,类似 git log 但适用于任意 URL,于是我构建了 crawldiff

安装

pip install crawldiff

快照站点

crawldiff crawl https://stripe.com/pricing

查看之后的变化

crawldiff diff https://stripe.com/pricing --since 7d

功能

  • Git 风格的 diff – 在终端显示彩色的统一 diff。
  • AI 摘要 – 使用 Claude、GPT 或 Cloudflare Workers AI 生成简洁的变更摘要(例如 “定价从 $25 上涨到 $30,新增 Enterprise 级别”)。
  • 监视模式 – 持续监控某个 URL(例如 crawldiff watch https://competitor.com --every 1h)。
  • 多种输出格式 – 终端、JSON(可 pipe 到 jq/Slack)、Markdown 报告。
  • 增量爬取 – 仅通过 Cloudflare 的 modifiedSince 获取已更改的页面。
  • 本地存储 – 所有快照存储在 ~/.crawldiff/ 下的 SQLite 中。

技术栈

  • Python 3.12
  • typerrichhttpx
  • Cloudflare Browser Rendering /crawl API
  • 用于统一 diff 的 difflib
  • SQLite 用于本地快照存储
  • 96 个测试,mypy 严格模式,GitHub Actions CI

链接

  • GitHub:
  • PyPI:

欢迎随时提问!

0 浏览
Back to Blog

相关文章

阅读更多 »