Standalone CLI & library for Google's NotebookLM — generate audio podcasts, analyze content, manage notebooks, and chat.
- Node.js 20+
- Google Chrome — only needed for first-time login
- A Google account with NotebookLM access
npm i notebooklm-clientOr from source:
git clone https://github.com/icebear0828/notebooklm-client.git && cd notebooklm-client
npm install
npm run buildnpx notebooklm export-session
# Opens Chrome → log in to Google → done# List notebooks
npx notebooklm list --transport auto
# Generate audio podcast from a URL
npx notebooklm audio --transport auto --url "https://en.wikipedia.org/wiki/TypeScript" -o ./output -l en
# Generate audio podcast from a topic
npx notebooklm audio --transport auto --topic "quantum computing" -o ./output
# Analyze content
npx notebooklm analyze --transport auto --url "https://example.com/paper.pdf" --question "What are the key findings?"
# Chat with a notebook
npx notebooklm chat <notebook-id> --transport auto --question "Summarize this"
# Show notebook details
npx notebooklm detail <notebook-id> --transport auto
# Diagnose issues
npx notebooklm diagnose --transport <mode> auto | browser (default: browser)
--home <dir> Config directory (default: ~/.notebooklm)
--session-path <path> Custom session file path
--headless Run browser without visible window
--chrome-path <path> Chrome executable path
--proxy <url> Proxy URL (http/socks5/socks5h, or set HTTPS_PROXY env)
| Command | Description |
|---|---|
export-session |
Login via browser and save session |
import-session <file|json> |
Import session from file or JSON string |
list |
List all notebooks |
detail <id> |
Show notebook title and sources |
chat <id> --question "..." |
Chat with a notebook |
audio |
Generate audio podcast |
analyze |
Analyze content with a question |
diagnose |
Generate diagnostic report for troubleshooting |
skill install |
Install AI agent skill (Claude Code / Codex) |
--url <url> Source URL
--text <text> Source text content
--topic <topic> Research topic (web search)
--research-mode <mode> fast or deep (default: fast)
-o, --output <dir> Output directory (required)
-l, --language <lang> Audio language (default: en)
--custom-prompt <prompt> Custom generation prompt
--keep-notebook Keep notebook after completion
Use different config directories for different Google accounts:
# Default account
npx notebooklm list --transport auto
# Work account
npx notebooklm --home ~/.notebooklm-work list --transport auto
# Or via environment variable
NOTEBOOKLM_HOME=~/.notebooklm-work npx notebooklm list --transport autoimport { NotebookClient } from 'notebooklm-client';
const client = new NotebookClient();
await client.connect({ transport: 'auto' });
// List notebooks
const notebooks = await client.listNotebooks();
// Create notebook and add sources
const { notebookId } = await client.createNotebook();
await client.addUrlSource(notebookId, 'https://example.com');
await client.addTextSource(notebookId, 'Title', 'Content...');
// Chat
const detail = await client.getNotebookDetail(notebookId);
const { text } = await client.sendChat(notebookId, 'Summarize', detail.sources.map(s => s.id));
// Check available features and account limits
const config = await client.getStudioConfig(notebookId);
const account = await client.getAccountInfo();
// Generate artifacts (audio, slides, docs — types fetched dynamically)
const audioType = config.audioTypes.find(t => t.name === 'Deep Dive');
await client.generateArtifact(notebookId, audioType.id, sourceIds, { language: 'en' });
await client.disconnect();// Lifecycle
await client.connect(options)
await client.disconnect()
await client.exportSession(path?)
client.getTransportMode()
// Notebooks
await client.listNotebooks() // → NotebookInfo[]
await client.createNotebook() // → { notebookId }
await client.getNotebookDetail(notebookId) // → { title, sources }
await client.deleteNotebook(notebookId)
// Sources
await client.addUrlSource(notebookId, url) // → { sourceId, title }
await client.addTextSource(notebookId, title, text) // → { sourceId, title }
await client.createWebSearch(notebookId, query, mode) // → { researchId }
await client.getSourceSummary(sourceId) // → { summary }
await client.deleteSource(sourceId)
// Chat
await client.sendChat(notebookId, message, sourceIds) // → { text, threadId }
await client.deleteChatThread(threadId)
// Studio (dynamic — always fetch types from server)
await client.getStudioConfig(notebookId) // → StudioConfig
await client.getAccountInfo() // → AccountInfo
// Artifacts
await client.generateArtifact(notebookId, type, sourceIds, options)
await client.getArtifacts(notebookId) // → ArtifactInfo[]
await client.downloadAudio(downloadUrl, outputDir) // → filePath
await client.deleteArtifact(artifactId)
// High-level workflows
await client.runAudioOverview(options, onProgress?) // → { audioPath, notebookUrl }
await client.runAnalyze(options, onProgress?) // → { answer, notebookUrl }docker build -t notebooklm .
docker run -v ~/.notebooklm:/root/.notebooklm notebooklm list --transport autoInstall the /notecraft skill for Claude Code or Codex:
npx notebooklm skill install # Install for current user
npx notebooklm skill install --scope project # Install for current project
npx notebooklm skill status # Check install status
npx notebooklm skill uninstall # RemoveAfter installing, use /notecraft in your agent to automate NotebookLM tasks.
Run npx notebooklm diagnose and paste the output when reporting issues.
Common issues:
- "No session available" → Run
npx notebooklm export-session - "Session expired" → Tokens auto-refresh; if still fails, re-run
export-session - Audio generation fails → Check account limits with
getAccountInfo() - Connection timeout (China) → Use
--proxy socks5://127.0.0.1:7890or setHTTPS_PROXYenv var - Audio download returns login page → Re-run
npx notebooklm export-sessionto refresh cookies
MIT
Google NotebookLM 的独立 CLI 和编程库 —— 生成音频播客、分析内容、管理笔记本、对话。
- Node.js 20+
- Google Chrome —— 仅首次登录需要
- 一个有 NotebookLM 访问权限的 Google 账号
npm i notebooklm-client或从源码安装:
git clone https://github.com/icebear0828/notebooklm-client.git && cd notebooklm-client
npm install
npm run buildnpx notebooklm export-session
# 打开 Chrome → 登录 Google 账号 → 完成# 列出笔记本
npx notebooklm list --transport auto
# 从 URL 生成音频播客
npx notebooklm audio --transport auto --url "https://zh.wikipedia.org/wiki/TypeScript" -o ./output -l zh
# 从话题生成音频播客
npx notebooklm audio --transport auto --topic "量子计算" -o ./output
# 分析内容
npx notebooklm analyze --transport auto --url "https://example.com/paper.pdf" --question "主要发现是什么?"
# 与笔记本对话
npx notebooklm chat <notebook-id> --transport auto --question "帮我总结一下"
# 查看笔记本详情
npx notebooklm detail <notebook-id> --transport auto
# 诊断问题
npx notebooklm diagnose --transport <mode> auto | browser(默认 browser)
--home <dir> 配置目录(默认 ~/.notebooklm)
--session-path <path> 自定义 session 文件路径
--headless 无头模式(不显示浏览器窗口)
--chrome-path <path> Chrome 可执行文件路径
--proxy <url> 代理地址(http/socks5/socks5h,或设置 HTTPS_PROXY 环境变量)
| 命令 | 说明 |
|---|---|
export-session |
通过浏览器登录并保存 session |
import-session <file|json> |
从文件或 JSON 字符串导入 session |
list |
列出所有笔记本 |
detail <id> |
显示笔记本标题和来源 |
chat <id> --question "..." |
与笔记本对话 |
audio |
生成音频播客 |
analyze |
分析内容并回答问题 |
diagnose |
生成诊断报告(用于提交 issue) |
skill install |
安装 AI agent skill(Claude Code / Codex) |
--url <url> 素材 URL
--text <text> 素材文本内容
--topic <topic> 研究话题(网页搜索)
--research-mode <mode> fast 或 deep(默认 fast)
-o, --output <dir> 输出目录(必填)
-l, --language <lang> 音频语言(默认 en)
--custom-prompt <prompt> 自定义生成提示词
--keep-notebook 完成后保留笔记本
不同 Google 账号使用不同配置目录:
# 默认账号
npx notebooklm list --transport auto
# 工作账号
npx notebooklm --home ~/.notebooklm-work list --transport auto
# 或通过环境变量
NOTEBOOKLM_HOME=~/.notebooklm-work npx notebooklm list --transport autoimport { NotebookClient } from 'notebooklm-client';
const client = new NotebookClient();
await client.connect({ transport: 'auto' });
// 列出笔记本
const notebooks = await client.listNotebooks();
// 创建笔记本并添加来源
const { notebookId } = await client.createNotebook();
await client.addUrlSource(notebookId, 'https://example.com');
await client.addTextSource(notebookId, '标题', '内容...');
// 对话
const detail = await client.getNotebookDetail(notebookId);
const { text } = await client.sendChat(notebookId, '帮我总结', detail.sources.map(s => s.id));
// 查看可用功能和账号限额
const config = await client.getStudioConfig(notebookId);
const account = await client.getAccountInfo();
// 生成产物(音频、幻灯片、文档 —— 类型从服务端动态获取)
const audioType = config.audioTypes.find(t => t.name === 'Deep Dive');
await client.generateArtifact(notebookId, audioType.id, sourceIds, { language: 'zh' });
await client.disconnect();// 生命周期
await client.connect(options)
await client.disconnect()
await client.exportSession(path?)
client.getTransportMode()
// 笔记本
await client.listNotebooks() // → NotebookInfo[]
await client.createNotebook() // → { notebookId }
await client.getNotebookDetail(notebookId) // → { title, sources }
await client.deleteNotebook(notebookId)
// 来源
await client.addUrlSource(notebookId, url) // → { sourceId, title }
await client.addTextSource(notebookId, title, text) // → { sourceId, title }
await client.createWebSearch(notebookId, query, mode) // → { researchId }
await client.getSourceSummary(sourceId) // → { summary }
await client.deleteSource(sourceId)
// 对话
await client.sendChat(notebookId, message, sourceIds) // → { text, threadId }
await client.deleteChatThread(threadId)
// Studio(动态 —— 始终从服务端获取类型)
await client.getStudioConfig(notebookId) // → StudioConfig
await client.getAccountInfo() // → AccountInfo
// 产物
await client.generateArtifact(notebookId, type, sourceIds, options)
await client.getArtifacts(notebookId) // → ArtifactInfo[]
await client.downloadAudio(downloadUrl, outputDir) // → filePath
await client.deleteArtifact(artifactId)
// 高级工作流
await client.runAudioOverview(options, onProgress?) // → { audioPath, notebookUrl }
await client.runAnalyze(options, onProgress?) // → { answer, notebookUrl }docker build -t notebooklm .
docker run -v ~/.notebooklm:/root/.notebooklm notebooklm list --transport auto安装 /notecraft skill 到 Claude Code 或 Codex:
npx notebooklm skill install # 安装到当前用户
npx notebooklm skill install --scope project # 安装到当前项目
npx notebooklm skill status # 查看安装状态
npx notebooklm skill uninstall # 卸载安装后在 agent 中使用 /notecraft 即可自动化 NotebookLM 操作。
运行 npx notebooklm diagnose,将输出贴到 issue 中。
常见问题:
- "No session available" → 运行
npx notebooklm export-session - "Session expired" → Token 会自动刷新;如果仍然失败,重新运行
export-session - 音频生成失败 → 通过
getAccountInfo()检查账号限额 - 连接超时(中国用户) → 使用
--proxy socks5://127.0.0.1:7890或设置HTTPS_PROXY环境变量 - 下载音频拿到登录页 → 重新运行
npx notebooklm export-session刷新 cookies
MIT
--transport automode with automatic best-engine selection- Auto-installed optimized HTTP engine on
npm install - Dynamic studio config:
getStudioConfig()fetches available types from server - Account API:
getAccountInfo()returns plan type, notebook/source limits - Multi-account support:
--homeflag andNOTEBOOKLM_HOMEenv var diagnosecommand for troubleshooting- Docker support (amd64/arm64)
--transport auto模式,自动选择最佳引擎npm install时自动安装优化 HTTP 引擎- 动态 Studio 配置:
getStudioConfig()从服务端获取可用类型 - 账号 API:
getAccountInfo()返回计划类型、笔记本/来源限额 - 多账号支持:
--home参数和NOTEBOOKLM_HOME环境变量 diagnose诊断命令- Docker 支持(amd64/arm64)
- Full NotebookLM API: notebooks, sources, chat, audio generation
- Browser and headless modes
- Session persistence with auto token refresh
- CLI with all core commands
- 完整 NotebookLM API:笔记本、来源、对话、音频生成
- 浏览器和无头模式
- Session 持久化 + token 自动刷新
- CLI 包含所有核心命令