teng-lin / notebooklm-py

teng-lin / notebooklm-py

notebooklm-py: A Comprehensive NotebookLM Skill & Unofficial Python API. Full programmatic access to NotebookLM’s features—including capabilities the web UI doesn’t expose—via Python, CLI, and AI agents like Claude Code, Codex, and OpenClaw. notebooklm-py:一个全面的 NotebookLM 技能库与非官方 Python API。 通过 Python、CLI 以及 Claude Code、Codex 和 OpenClaw 等 AI 智能体,实现对 NotebookLM 功能的全面程序化访问,包括 Web 界面未公开的功能。

Source & Development: https://github.com/teng-lin/notebooklm-py 源码与开发:https://github.com/teng-lin/notebooklm-py

⚠️ Unofficial Library - Use at Your Own Risk ⚠️ 非官方库 - 使用风险自担

This library uses undocumented Google APIs that can change without notice. 该库使用了未公开的 Google API,这些 API 可能会在不另行通知的情况下发生变更。

  • Not affiliated with Google - This is a community project.
  • 与 Google 无关 - 这是一个社区项目。
  • APIs may break - Google can change internal endpoints anytime.
  • API 可能失效 - Google 随时可能更改内部端点。
  • Rate limits apply - Heavy usage may be throttled.
  • 受速率限制 - 高频使用可能会被限流。
  • Best for prototypes, research, and personal projects. See Troubleshooting for debugging tips.
  • 最适合原型开发、研究和个人项目。 请参阅“故障排除”获取调试建议。

What You Can Build / 你可以构建什么

  • 🤖 AI Agent Tools - Integrate NotebookLM into Claude Code, Codex, and other LLM agents. Ships with a root NotebookLM skill for GitHub and npx skills add discovery, local notebooklm skill install support for Claude Code and .agents skill directories, and repo-level Codex guidance in AGENTS.md.

  • 🤖 AI 智能体工具 - 将 NotebookLM 集成到 Claude Code、Codex 和其他 LLM 智能体中。附带用于 GitHub 的根 NotebookLM 技能,支持 npx 技能发现、Claude Code 的本地 notebooklm 技能安装、.agents 技能目录,以及 AGENTS.md 中的仓库级 Codex 指导。

  • 📚 Research Automation - Bulk-import sources (URLs, PDFs, YouTube, Google Drive), run web/Drive research queries with auto-import, and extract insights programmatically. Build repeatable research pipelines.

  • 📚 研究自动化 - 批量导入来源(URL、PDF、YouTube、Google Drive),通过自动导入运行 Web/Drive 研究查询,并以程序化方式提取见解。构建可重复的研究流水线。

  • 🎙️ Content Generation - Generate Audio Overviews (podcasts), videos, slide decks, quizzes, flashcards, infographics, data tables, mind maps, and study guides. Full control over formats, styles, and output.

  • 🎙️ 内容生成 - 生成音频概览(播客)、视频、幻灯片、测验、抽认卡、信息图表、数据表、思维导图和学习指南。完全控制格式、风格和输出。

  • 📥 Downloads & Export - Download all generated artifacts locally (MP3, MP4, PDF, PNG, CSV, JSON, Markdown). Export to Google Docs/Sheets. Features the web UI doesn’t offer: batch downloads, quiz/flashcard export in multiple formats, mind map JSON extraction.

  • 📥 下载与导出 - 在本地下载所有生成的制品(MP3、MP4、PDF、PNG、CSV、JSON、Markdown)。导出到 Google Docs/Sheets。Web 界面不提供的功能包括:批量下载、多种格式的测验/抽认卡导出、思维导图 JSON 提取。

Three Ways to Use / 三种使用方式

MethodBest For
Python APIApplication integration, async workflows, custom pipelines
CLIShell scripts, quick tasks, CI/CD automation
Agent IntegrationClaude Code, Codex, LLM agents, natural language automation
方法最适合
Python API应用程序集成、异步工作流、自定义流水线
CLIShell 脚本、快速任务、CI/CD 自动化
智能体集成Claude Code、Codex、LLM 智能体、自然语言自动化

Features Complete NotebookLM Coverage / 功能:完整的 NotebookLM 覆盖

CategoryCapabilities
NotebooksCreate, list, rename, delete
SourcesURLs, YouTube, files (PDF, text, Markdown, Word, EPUB, audio, video, images), Google Drive, pasted text; refresh, get guide/fulltext
ChatQuestions, conversation history, custom personas
ResearchWeb and Drive research agents (fast/deep modes) with auto-import
SharingPublic/private links, user permissions (viewer/editor), view level control
类别功能
笔记本创建、列出、重命名、删除
来源URL、YouTube、文件(PDF、文本、Markdown、Word、EPUB、音频、视频、图像)、Google Drive、粘贴文本;刷新、获取指南/全文
聊天问题、对话历史、自定义角色
研究Web 和 Drive 研究智能体(快速/深度模式),支持自动导入
共享公开/私有链接、用户权限(查看者/编辑者)、视图级别控制

Beyond the Web UI / 超越 Web 界面

These features are available via API/CLI but not exposed in NotebookLM’s web interface: 以下功能可通过 API/CLI 使用,但在 NotebookLM 的 Web 界面中未公开:

  • Batch downloads - Download all artifacts of a type at once.
  • 批量下载 - 一次性下载某种类型的所有制品。
  • Quiz/Flashcard export - Get structured JSON, Markdown, or HTML (web UI only shows interactive view).
  • 测验/抽认卡导出 - 获取结构化的 JSON、Markdown 或 HTML(Web 界面仅显示交互式视图)。
  • Mind map data extraction - Export hierarchical JSON for visualization tools.
  • 思维导图数据提取 - 导出用于可视化工具的层级 JSON。
  • Data table CSV export - Download structured tables as spreadsheets.
  • 数据表 CSV 导出 - 将结构化表格下载为电子表格。
  • Slide deck as PPTX - Download editable PowerPoint files (web UI only offers PDF).
  • 幻灯片 PPTX 格式 - 下载可编辑的 PowerPoint 文件(Web 界面仅提供 PDF)。
  • Slide revision - Modify individual slides with natural-language prompts.
  • 幻灯片修订 - 使用自然语言提示修改单个幻灯片。
  • Report template customization - Append extra instructions to built-in format templates.
  • 报告模板自定义 - 在内置格式模板中附加额外指令。
  • Save chat to notes - Save Q&A answers or conversation history as notebook notes.
  • 保存聊天到笔记 - 将问答答案或对话历史保存为笔记本笔记。
  • Source fulltext access - Retrieve the indexed text content of any source.
  • 来源全文访问 - 获取任何来源的索引文本内容。
  • Programmatic sharing - Manage permissions without the UI.
  • 程序化共享 - 无需通过 UI 即可管理权限。
  • Multi-account profiles - Switch between Google accounts without re-authenticating.
  • 多账户配置 - 在 Google 账户之间切换而无需重新验证。
  • Browser cookie import - Reuse cookies from your existing browser session instead of driving Playwright.
  • 浏览器 Cookie 导入 - 重用现有浏览器会话中的 Cookie,无需驱动 Playwright。

Installation / 安装

The full install guide — six personas (agent, end-user, library, headless, contributor, power-user), optional extras matrix, platform notes — lives in docs/installation.md. 完整的安装指南(涵盖六种角色:智能体、终端用户、库、无头模式、贡献者、高级用户)、可选扩展矩阵及平台说明,请参阅 docs/installation.md

Quickest start (CLI users and AI agents): 最快上手(CLI 用户和 AI 智能体):

pip install "notebooklm-py[browser]" # core + Playwright
playwright install chromium # ~170 MB; no progress bar — be patient (30–90 s)
notebooklm login # opens browser for Google sign-in
notebooklm auth check --test --json # verify: expect "status": "ok"

As a library (embedded in your app — no Playwright, no Chromium): 作为库使用(嵌入到您的应用中 — 无需 Playwright,无需 Chromium):

pip install notebooklm-py # ~10 MB; ship a pre-acquired storage_state.json

Quick Start / 快速开始

# 1. Authenticate (opens browser)
notebooklm login

# 2. Create a notebook and add sources
notebooklm create "My Research"
notebooklm use <notebook_id>
notebooklm source add "https://en.wikipedia.org/wiki/Artificial_intelligence"
notebooklm source add "./paper.pdf"

# 3. Chat with your sources
notebooklm ask "What are the key themes?"

# 4. Generate content
notebooklm generate audio "make it engaging" --wait
notebooklm generate video --style whiteboard --wait