详细分析 ▾
运行时依赖
版本
改进 README:更清晰的价值主张,移除已删除脚本,修复链接,优化 SKILL.md 以供搜索
安装命令
点击复制技能文档
# CastReader — 朗读网页与书籍 ## 安装(每会话一次) `` cd && npm install ` ## 如何获取 target(chatId) 用户消息格式类似: [Telegram username id:8716240840 ...] id: 后面的数字即为 target。你必须在每次调用 message 工具时使用该数字。 示例:target 为 "8716240840"。 --- ## 模式 A:用户发送 URL ### 步骤 1:提取文章 ` node scripts/read-url.js "" 0 ` 返回: { title, language, totalParagraphs, totalCharacters, paragraphs[] } ### 步骤 2:展示信息并让用户选择 回复以下内容: ` 📖 {title} 🌐 {language} · 📝 {totalParagraphs} 段落 · 📊 {totalCharacters} 字符 📋 摘要:{从段落中写 2–3 句摘要} 回复数字选择: 1️⃣ 收听全文(约 {totalCharacters} 字符,生成约 {Math.ceil(totalCharacters / 200)} 秒) 2️⃣ 仅收听摘要(约 {summary_char_count} 字符,生成约 {Math.ceil(summary_char_count / 200)} 秒) ` 停止。等待用户回复 1 或 2。 ### 步骤 3a:用户选 1(全文) 回复:🎙️ 正在生成全文音频(约 {totalCharacters} 字符,约 {Math.ceil(totalCharacters / 200)} 秒)... ` node scripts/read-url.js "" all ` 然后使用 message 工具发送音频文件: `json {"action":"send", "target":"", "channel":"telegram", "filePath":"", "caption":"🔊 {title}"} ` 回复:✅ 完成! ### 步骤 3b:用户选 2(仅摘要) 回复:🎙️ 正在生成摘要音频... 将步骤 2 中展示的相同摘要文本保存到文件并生成: ` echo "
" > /tmp/castreader-summary.txt node scripts/generate-text.js /tmp/castreader-summary.txt ` 然后使用 message 工具发送音频文件: `json {"action":"send", "target":"", "channel":"telegram", "filePath":"/tmp/castreader-summary.mp3", "caption":"📋 摘要:{title}"} ` 回复:✅ 完成! --- ## 模式 B:用户要求朗读书籍(微信读书 / Kindle) 书籍从微信读书或 Kindle 同步到 ~/castreader-library/books/。 每本书保存在形如 书名-hashid 的文件夹中(例如 儒林外史-dc532c705c6d3edc5503acc)。 ⚠️ 关键:你必须先用 sync-books.js --list 获取确切的图书文件夹 ID。绝不要猜测或手动构造路径。文件夹名包含不可预测的前缀。 ### 步骤 1:列出可用书籍 ` node scripts/sync-books.js --list ` 返回: { books: [{ id, title, author, language, totalChapters, totalCharacters, source, syncedAt }] } 其中的 id 字段就是后续命令必须使用的确切文件夹名。 示例:"儒林外史-dc532c705c6d3edc5503acc"。 ### 步骤 2:展示书单并让用户选择 回复书单: ` 📚 你已同步的书籍: 1. 📖 {title} — {author} 🌐 {language} · 📑 {totalChapters} 章 · 📊 {totalCharacters} 字符 · 📱 {source} 2. ... 回复数字选择要听的书。 ` 停止。等待用户选择。 ### 步骤 3:展示章节列表并让用户选择 ` node scripts/sync-books.js --book "" ` 使用步骤 1 输出中的确切 id。 返回书籍内容及章节列表。 回复: ` 📖 {title} — {author} 📑 {totalChapters} 章 · 📊 {totalCharacters} 字符 📋 章节: 1. {chapter 1 title} 2. {chapter 2 title} ... 回复数字收听对应章节,或回复 "all" 收听整本书。 ` 停止。等待用户选择。 ### 步骤 4a:用户选择章节号 ` node scripts/sync-books.js --book "" --chapter --audio ` 返回: { title, audioFile, fileSizeBytes } 发送音频: `json {"action":"send", "target":"", "channel":"telegram", "filePath":"", "caption":"🔊 {bookTitle} — 第 {num} 章"} ` ### 步骤 4b:用户选择 "all"(整本书) ` node scripts/sync-books.js --book "" --audio ` 返回: { title, audioFile, fileSizeBytes } 发送音频: `json {"action":"send", "target":"", "channel":"telegram", "filePath":"", "caption":"🔊 {bookTitle}(全文)"} ` ### 仅阅读章节文本(不生成音频) 若用户只想阅读(不听),去掉 --audio: ` node scripts/sync-books.js --book "" --chapter ` 返回: { title, author, language, chapter: { number, title, text }, totalChapters } --- ## 规则 - 必须先提取(URL 用 index=0,书籍用 --list),展示信息,等待用户选择。绝不跳过。 - 必须使用 message 工具发送音频文件,并带上 target(数字 chatId)和 channel("telegram")。绝不要只打印文件路径。 - 书籍:必须先运行 --list,并使用输出中的确切 id。绝不要手动构造路径或使用部分 ID。 - 不要使用内置 TTS 工具。仅使用 read-url.js、generate-text.js 和 sync-books.js。 - 不要使用 web_fetch。仅使用 read-url.js。 - 不要使用 read 工具直接访问 ~/castreader-library/ 下的文件。仅使用 sync-books.js`。