fetch-content
抓取 URL 网页内容并转为 Markdown 存储。
执行步骤
注意:下面的
<SKILL_DIR>指本 SKILL.md 所在的目录,请根据实际路径替换。
- •
运行抓取脚本(默认处理当天):
bashpython <SKILL_DIR>/scripts/fetch_page.py
或指定日期:
bashpython <SKILL_DIR>/scripts/fetch_page.py --date 2026-02-14
- •
脚本会自动:
- •读取
data/urls/YYYY-MM-DD.json中status: pending的条目 - •用 requests 抓取网页内容
- •用 BeautifulSoup + markdownify 转为 Markdown
- •添加 frontmatter(source_url、fetch_time、hash)
- •存入
data/raw-docs/{hash}.md - •更新日期 JSON 中该条目
status: fetched
- •读取
- •
抓取失败的 URL 会标记为
status: failed并记录错误信息。
输出
每个成功抓取的 URL 生成一个 data/raw-docs/{hash}.md 文件,格式:
markdown
--- source_url: https://example.com/article fetch_time: 2026-02-14T10:30:00 hash: a1b2c3d4e5f67890 title: 文章标题 --- (网页正文内容,已转为 Markdown)