notebooklm-py

Unofficial Python API & CLI for Google NotebookLM. Full programmatic access to NotebookLM’s features — including capabilities the web UI doesn’t expose — via Python, CLI, and AI agents (Claude Code, Codex, OpenCode).

What You Can Build

  • AI Agent Tools — Integrate NotebookLM into Claude Code, Codex, and other LLM agents. Ships with a SKILL.md for npx skills add discovery and local skill install.
  • Research Automation — Bulk-import sources (URLs, PDFs, YouTube, Google Drive), run web/Drive research queries with auto-import, extract insights programmatically.
  • Content Generation — Audio Overviews (podcasts), video, slide decks, quizzes, flashcards, infographics, data tables, mind maps, study guides.
  • Downloads & Export — Download all generated artifacts locally (MP3, MP4, PDF, PNG, CSV, JSON, Markdown). Export to Google Docs/Sheets.

Features Beyond the Web UI

These features are available via API/CLI but not in NotebookLM’s web interface:

  • Batch downloads of all artifacts of a type
  • Quiz/Flashcard export as structured JSON, Markdown, or HTML
  • Mind map data extraction as hierarchical JSON
  • Data table CSV export
  • Slide deck as PPTX (web UI only offers PDF)
  • Individual slide revision with natural-language prompts
  • Report template customization
  • Save chat Q&A to notebook notes
  • Source fulltext access
  • Programmatic sharing & permissions
  • Multi-account profiles (switch without re-authenticating)
  • Browser cookie import (skip Playwright)

Installation

# Quick start (CLI + Playwright)
pip install "notebooklm-py[browser]"
playwright install chromium
notebooklm login
notebooklm auth check --test --json
 
# As a library (no Playwright)
pip install notebooklm-py

Quick Start (CLI)

notebooklm login                              # Authenticate
notebooklm create "My Research"              # Create notebook
notebooklm source add "https://..."           # Add sources
notebooklm ask "What are the key themes?"    # Chat with sources
 
# Generate content
notebooklm generate audio "make it engaging" --wait
notebooklm generate video --style whiteboard --wait
notebooklm generate quiz --difficulty hard
notebooklm generate flashcards --quantity more
notebooklm generate slide-deck
notebooklm generate infographic --orientation portrait
notebooklm generate mind-map
notebooklm generate data-table "compare key concepts"
 
# Download artifacts
notebooklm download audio ./podcast.mp3
notebooklm download quiz --format markdown ./quiz.md
notebooklm download slide-deck ./slides.pdf

Quick Start (Python)

import asyncio
from notebooklm import NotebookLMClient
 
async def main():
    async with NotebookLMClient.from_storage() as client:
        nb = await client.notebooks.create("Research")
        await client.sources.add_url(nb.id, "https://example.com", wait=True)
        result = await client.chat.ask(nb.id, "Summarize this")
        print(result.answer)
 
asyncio.run(main())

Agent Integration

# CLI install for Claude Code / Codex
notebooklm skill install
 
# Or via npx skills ecosystem
npx skills add teng-lin/notebooklm-py

Content Generation Types

TypeDownload Format
Audio Overview (deep-dive, brief, critique, debate)MP3/MP4
Video Overview (explainer, brief, cinematic)MP4
Slide Deck (detailed, presenter)PDF, PPTX
Infographic (3 orientations, 3 detail levels)PNG
Quiz (configurable difficulty & quantity)JSON, Markdown, HTML
FlashcardsJSON, Markdown, HTML
Report (briefing, study guide, blog, custom)Markdown
Data TableCSV
Mind Map (interactive studio or note-backed JSON)JSON

License

MIT