电子书收藏,部署在 books.lulununu.com。
oreilly/ 目录下按书名存放 markdown + 合并的 book.mdtools/ 目录下 Go CLI,用 chrome-cli 控制 Chrome 抓取 O'Reilly 页面release 分支部署⚠️ 只支持旧版 O'Reilly 阅读器(URL 含 kindle_split_xxx.html,页面有 #book-content 元素)。
新版阅读器(URL 含 .xhtml,如第二版 CSS in Depth 9781633438354)不兼容,会报 Element with id "book-content" not found。
判断方法:通过 ezproxy 打开书籍任意章节,检查页面是否有 #book-content。
找到书的任意章节页面 URL,通常是第一个 kindle_split 页面,例如:
https://www.oreilly.com/library/view/css-in-depth/9781617293450/OEBPS/Text/kindle_split_001.html
在 GitHub Actions 手动触发 Batch Convert O'Reilly Book workflow:
gh workflow run convert-book.yml --repo aibeta/books \
--field url="<起始URL>" \
--field wait="10" \
--field retry="3"
workflow 会自动:
oreilly/<书名>/XX-kindle_split_YYY.mdbook.md(按 kindle_split 编号排序,跳过目录/索引等)push 到 main 后会自动触发 generate-index.yml:
book.md 转为 book.html(带暗黑模式、翻页按钮、阅读位置书签等自定义样式)book.md,只生成 book.html,不为单章 .md 生成独立 htmlindex.htmlrelease 分支 → Cloudflare Pages 自动部署注意:github-actions bot 的 push 不会触发 generate-index.yml。如果 batch 完成后没有自动部署,需要手动推一个空 commit:
cd <repo> && git commit --allow-empty -m "trigger deploy" && git push origin main
访问 https://books.lulununu.com/oreilly/<书名>/ 确认所有章节和 book.html 可访问。
gh workflow run convert-chapter.yml --repo aibeta/books \
--field url="<章节URL>" \
--field wait="10"
cd tools && go build -o dist/web-html-2-local main.go
./dist/web-html-2-local --merge oreilly/<书名>/
oreilly/<书名>/
├── book.md # 合并后的完整 markdown(含目录,图片用相对路径)
├── book.html # 自动生成的 HTML(带自定义样式)
├── images/ # 提取的图片文件
│ ├── 001.png
│ ├── 002.png
│ └── ...
├── 01-kindle_split_001.md # 源文件(保留但不生成 html)
├── 02-kindle_split_002.md
└── ...
kindle_split 编号排序(非文件名前缀)--- 分隔所有功能和 bug 修复都遵循 TDD 流程:
cd tools && go test ./merge/ -v
绝对不能跳过测试直接写实现。