NotebookLM Skill
Provides full programmatic access to Google NotebookLM via the unofficial notebooklm-py library. Supports Python API and CLI — use the Python API for complex or multi-step workflows, CLI for quick one-off tasks.
Prerequisites
pip install "notebooklm-py[browser]"
playwright install chromium
# First-time auth (opens browser)
notebooklm login
Auth via env variable (CI/CD, no browser):
export NOTEBOOKLM_AUTH_JSON='{"cookies": [...]}'
Read references/auth.md for detailed authentication setup.
Quick Start Pattern
import asyncio
from notebooklm import NotebookLMClient
async def main():
async with await NotebookLMClient.from_storage() as client:
nb = await client.notebooks.create("My Research")
await client.sources.add_url(nb.id, "https://example.com/article", wait=True)
result = await client.chat.ask(nb.id, "Summarize the main points")
print(result.answer)
asyncio.run(main())
API Reference Summary
Client Structure
NotebookLMClient
├── .notebooks → NotebooksAPI
├── .sources → SourcesAPI
├── .artifacts → ArtifactsAPI
├── .chat → ChatAPI
├── .research → ResearchAPI
├── .notes → NotesAPI
└── .sharing → SharingAPI
Notebooks (client.notebooks)
| Method |
Description |
list() |
List all notebooks |
create(title) |
Create new notebook → Notebook |
get(notebook_id) |
Get notebook details |
delete(notebook_id) |
Delete notebook |
rename(notebookid, newtitle) |
Rename notebook |
getdescription(notebookid) |
Get AI summary + suggested topics |
Sources (client.sources)
| Method |
Description |
addurl(nbid, url, wait=True) |
Add URL/YouTube source |
addfile(nbid, path, wait=True) |
Add local file (PDF, txt, md, docx, etc.) |
addtext(nbid, text, title, wait=True) |
Add pasted text |
adddrive(nbid, drive_id, title) |
Add Google Drive document |
list(nb_id) |
List all sources |
get(nbid, sourceid) |
Get source details |
fulltext(nbid, sourceid) |
Get indexed text content |
refresh(nbid, sourceid) |
Refresh URL source |
delete(nbid, sourceid) |
Delete source |
Chat (client.chat)
| Method |
Description |
ask(nbid, question, sourceids=None) |
Ask a question → ChatResult |
history(nb_id) |
Get conversation history |
configure(nb_id, mode=None, persona=None) |
Set chat mode/persona |
Artifacts — Generate (client.artifacts)
All generate methods return a GenerationStatus with taskid. Use waitfor_completion() to poll until done.
| Method |
Key Options |
Download Method |
generateaudio(nbid, instructions, format, length, language) |
format: deep-dive/brief/critique/debate, length: short/default/long |
downloadaudio(nbid, path) |
generatevideo(nbid, instructions, format, style) |
style: classic/whiteboard/kawaii/anime/watercolor/... |
downloadvideo(nbid, path) |
generatequiz(nbid, difficulty, quantity) |
difficulty: easy/medium/hard |
downloadquiz(nbid, path, output_format) |
generateflashcards(nbid, difficulty, quantity) |
— |
downloadflashcards(nbid, path, output_format) |
generateslidedeck(nb_id, instructions, format) |
format: detailed/presenter |
downloadslidedeck(nb_id, path) — PDF or PPTX |
generateinfographic(nbid, orientation, detail) |
orientation: landscape/portrait/square |
downloadinfographic(nbid, path) |
generatereport(nbid, format, instructions) |
format: briefing-doc/study-guide/blog-post/custom |
downloadreport(nbid, path) |
generatedatatable(nb_id, instructions) |
— |
downloaddatatable(nb_id, path) |
generatemindmap(nb_id) |
Sync, no wait needed |
downloadmindmap(nb_id, path) |
Wait pattern:
status = await client.artifacts.generate_audio(nb_id, instructions="Focus on key facts")
final = await client.artifacts.wait_for_completion(nb_id, status.task_id, timeout=300)
if final.is_complete:
await client.artifacts.download_audio(nb_id, "./podcast.mp3")
Research (client.research)
# Start web research
research = await client.research.start(nb_id, "quantum computing trends", source="web", mode="deep")
# Poll until complete
status = await client.research.poll(nb_id)
# Import discovered sources
await client.research.import_sources(nb_id, task_id, sources[:10])
CLI Quick Reference
# Session
notebooklm login
notebooklm use <notebook_id>
notebooklm status
# Notebooks
notebooklm list
notebooklm create "My Notebook"
notebooklm delete <id>
notebooklm rename "New Title"
# Sources
notebooklm source add "https://example.com"
notebooklm source add ./paper.pdf
notebooklm source add-research "AI trends 2025" --mode deep --import-all
notebooklm source list
# Chat
notebooklm ask "What are the key themes?"
# Generate (--wait blocks until done)
notebooklm generate audio "make it engaging" --wait
notebooklm generate video --style whiteboard --wait
notebooklm generate quiz --difficulty hard --wait
notebooklm generate flashcards --quantity more --wait
notebooklm generate slide-deck --wait
notebooklm generate infographic --orientation portrait --wait
notebooklm generate report --format study-guide --wait
notebooklm generate mind-map
# Download
notebooklm download audio ./podcast.mp3
notebooklm download video ./overview.mp4
notebooklm download quiz --format json ./quiz.json
notebooklm download flashcards --format markdown ./cards.md
notebooklm download slide-deck ./slides.pdf
notebooklm download mind-map ./mindmap.json
notebooklm download data-table ./data.csv
Common Workflows
Research → Podcast
See references/workflows.md for the full pattern.
Bulk Source Import
urls = ["https://...", "https://...", ...]
for url in urls:
await client.sources.add_url(nb_id, url, wait=False)
await asyncio.sleep(1) # Rate limiting
Quiz Generation + JSON Export
status = await client.artifacts.generate_quiz(nb_id, difficulty="hard")
final = await client.artifacts.wait_for_completion(nb_id, status.task_id)
await client.artifacts.download_quiz(nb_id, "quiz.json", output_format="json")
Error Handling
from notebooklm import RPCError
try:
result = await client.notebooks.create("Test")
except RPCError as e:
# Session expired → re-run `notebooklm login`
# Rate limited → wait and retry
print(f"Error: {e}")
Common issues:
RPCError auth failure → re-run notebooklm login or call await client.refresh_auth()
- Rate limits → add
await asyncio.sleep(2) between bulk operations
- Source not ready → use
wait=True in addurl() / addfile()
Reference Files
references/auth.md — Detailed auth setup, CI/CD, environment variables
references/workflows.md — Complete workflow examples (research→podcast, bulk import, etc.)
references/artifact-options.md — All generation options, formats, and styles