Skip to content

tmc/nlm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

144 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

nlm - NotebookLM CLI Tool πŸ“š

Go Reference Go Report Card

A powerful command-line interface for Google's NotebookLM, allowing you to manage notebooks, sources, notes, audio/video overviews, and AI-powered content transformation from your terminal.

πŸ”Š Listen to an Audio Overview of this tool: NotebookLM Audio Demo

✨ Features

  • πŸ“– Complete Notebook Management - Create, list, delete, and analyze notebooks
  • πŸ“ Source Operations - Add URLs, files, text, and YouTube videos as sources
  • πŸ“ Note Management - Create, edit, and organize notes within notebooks
  • 🎧 Audio/Video Overviews - Generate and download AI-powered audio and video summaries
  • πŸ› οΈ Artifact Creation - Create interactive reports, apps, and other content artifacts
  • πŸ€– AI Content Transformation - Rephrase, summarize, expand, critique, and transform content
  • πŸ’¬ Interactive Chat - Have conversations with your notebook content
  • πŸ” Advanced Generation - Create guides, outlines, study materials, timelines, and mindmaps
  • πŸ” Multi-Browser Authentication - Seamless auth with Chrome, Brave, Edge, and more
  • ⚑ Batch Operations - Execute multiple commands efficiently
  • πŸ”— Smart Sharing - Share notebooks publicly or privately with fine-grained control

πŸš€ Installation

Quick Install (Recommended)

go install github.com/tmc/nlm/cmd/nlm@latest

Build from Source

git clone https://github.com/tmc/nlm.git
cd nlm
go build -o nlm ./cmd/nlm
πŸ“¦ Installing Go (if needed)

Option 1: Using Package Managers

macOS (using Homebrew):

brew install go

Linux (Ubuntu/Debian):

sudo apt update
sudo apt install golang

Linux (Fedora):

sudo dnf install golang

Option 2: Direct Download

  1. Visit the Go Downloads page
  2. Download the appropriate version for your OS
  3. Follow the installation instructions

macOS:

  • Download the .pkg file and run the installer

Linux:

# Example for Linux AMD64
wget https://go.dev/dl/go1.24.6.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.24.6.linux-amd64.tar.gz

Post-Installation Setup

Add Go to your PATH:

export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:$(go env GOPATH)/bin

Verify installation:

go version

πŸ”‘ Authentication

Quick Start

# First-time setup - opens browser for Google account authentication
nlm auth

# List your notebooks to verify authentication
nlm list

Advanced Authentication

The nlm tool provides sophisticated browser-based authentication with automatic profile detection:

# Use specific browser profile
nlm auth --profile "Work Profile"

# Try all available browser profiles
nlm auth --all

# Check which profiles have NotebookLM access
nlm auth --notebooks

# Keep browser open for manual login (useful for troubleshooting)
nlm auth --keep-open 30

# Enable detailed authentication debugging
nlm auth --debug

Supported Browsers

The tool automatically detects and works with:

  • Google Chrome (default)
  • Google Chrome Canary
  • Brave Browser
  • Microsoft Edge
  • Chromium

Browser Profile Management

The authentication system intelligently:

  • Scans all browser profiles automatically
  • Prioritizes profiles with existing NotebookLM cookies
  • Uses most recently used profiles when possible
  • Preserves complete browser session state for better compatibility

πŸ’» Command Reference

πŸ“– Notebook Operations

# List all notebooks
nlm list
nlm ls                           # Shorthand

# Create a new notebook
nlm create "AI Research Notes"

# Delete a notebook
nlm rm <notebook-id>

# Show notebook analytics
nlm analytics <notebook-id>

# List featured/recommended notebooks
nlm list-featured

πŸ“ Source Management

# List sources in a notebook
nlm sources <notebook-id>

# Add sources from various inputs
nlm add <notebook-id> https://example.com/article
nlm add <notebook-id> research-paper.pdf
nlm add <notebook-id> data.json
nlm add <notebook-id> "Direct text content"
nlm add <notebook-id> https://youtube.com/watch?v=abc123

# Add from stdin with MIME type specification
cat document.xml | nlm add <notebook-id> - --mime="text/xml"
echo "Meeting notes" | nlm add <notebook-id> -

# Source operations
nlm rename-source <source-id> "New Title"
nlm refresh-source <source-id>
nlm check-source <source-id>
nlm rm-source <notebook-id> <source-id>

# Discover relevant sources
nlm discover-sources <notebook-id> "machine learning papers"

πŸ“ Note Management

# List notes in a notebook
nlm notes <notebook-id>

# Create and manage notes
nlm new-note <notebook-id> "Meeting Summary"
nlm update-note <notebook-id> <note-id> "Updated content" "New Title"
nlm rm-note <note-id>

🎧 Audio & Video Overviews

# Audio overview operations
nlm audio-list <notebook-id>
nlm audio-create <notebook-id> "Speak in a professional tone, focus on key insights"
nlm audio-get <notebook-id>
nlm audio-download <notebook-id> overview.mp3
nlm audio-share <notebook-id>
nlm audio-rm <notebook-id>

# Video overview operations
nlm video-list <notebook-id>
nlm video-create <notebook-id> "Create an engaging visual summary"
nlm video-download <notebook-id> summary.mp4

πŸ› οΈ Artifact Creation

# Create interactive artifacts
nlm create-artifact <notebook-id> note     # Interactive note
nlm create-artifact <notebook-id> audio    # Audio overview
nlm create-artifact <notebook-id> report   # Structured report
nlm create-artifact <notebook-id> app      # Interactive app

# Manage artifacts
nlm artifacts <notebook-id>
nlm list-artifacts <notebook-id>           # Alias
nlm get-artifact <artifact-id>
nlm rename-artifact <artifact-id> "New Title"
nlm delete-artifact <artifact-id>

πŸ€– AI Content Transformation

Transform your notebook content with AI-powered operations:

# Content transformation (specify source IDs to focus on specific sources)
nlm rephrase <notebook-id> <source-id1> <source-id2>
nlm expand <notebook-id> <source-id1>
nlm summarize <notebook-id> <source-id1> <source-id2>
nlm critique <notebook-id> <source-id1>
nlm brainstorm <notebook-id> <source-id1> <source-id2>

# Analysis and verification
nlm verify <notebook-id> <source-id1>
nlm explain <notebook-id> <source-id1>

# Study materials generation
nlm study-guide <notebook-id> <source-id1> <source-id2>
nlm faq <notebook-id> <source-id1>
nlm briefing-doc <notebook-id> <source-id1> <source-id2>

# Visual organization
nlm mindmap <notebook-id> <source-id1> <source-id2>
nlm timeline <notebook-id> <source-id1>
nlm outline <notebook-id> <source-id1> <source-id2>
nlm toc <notebook-id> <source-id1>

πŸ” AI Generation & Chat

# Content generation
nlm generate-guide <notebook-id>
nlm generate-outline <notebook-id>
nlm generate-section <notebook-id>
nlm generate-chat <notebook-id> "Explain the main themes"
nlm generate-magic <notebook-id> <source-id1> <source-id2>

# Interactive chat
nlm chat <notebook-id>              # Start interactive session
nlm chat-list                       # List saved chats

πŸ”— Sharing & Collaboration

# Share notebooks
nlm share <notebook-id>             # Public sharing
nlm share-private <notebook-id>     # Private sharing
nlm share-details <share-id>        # Get sharing details

πŸ”§ Utility Commands

# Authentication management
nlm auth [profile]                  # Setup/refresh authentication
nlm refresh                         # Refresh credentials

# System operations
nlm feedback "Great tool!"          # Submit feedback
nlm hb                              # Send heartbeat

πŸ“‹ Usage Examples

Complete Workflow Example

# 1. Create a new research notebook
notebook_id=$(nlm create "AI Ethics Research" | grep -o 'notebook [^ ]*' | cut -d' ' -f2)

# 2. Add diverse sources
nlm add $notebook_id https://arxiv.org/abs/2103.00020
nlm add $notebook_id "AI ethics guidelines.pdf"
nlm add $notebook_id https://youtube.com/watch?v=ethics-talk
nlm add $notebook_id "Personal notes: Key ethical concerns in AI deployment"

# 3. Generate study materials
nlm study-guide $notebook_id
nlm generate-outline $notebook_id
nlm faq $notebook_id

# 4. Create audio overview
nlm audio-create $notebook_id "Professional tone, focus on practical implications"

# 5. Transform content for different audiences
nlm rephrase $notebook_id        # Academic to accessible language
nlm briefing-doc $notebook_id    # Executive summary
nlm mindmap $notebook_id         # Visual organization

# 6. Share your research
nlm share-private $notebook_id

Batch Content Processing

# Process multiple sources for comprehensive analysis
sources=$(nlm sources $notebook_id | grep -o 'Source [^ ]*' | cut -d' ' -f2)

# Generate multiple content types
for source in $sources; do
    nlm summarize $notebook_id $source
    nlm explain $notebook_id $source
done

# Create comprehensive study package
nlm study-guide $notebook_id
nlm timeline $notebook_id
nlm generate-guide $notebook_id

πŸ”§ Advanced Configuration

Environment Variables

# Authentication (automatically managed by nlm auth)
export NLM_AUTH_TOKEN="your-token"
export NLM_COOKIES="your-cookies"
export NLM_BROWSER_PROFILE="Work Profile"

Debug Mode

Enable detailed logging for troubleshooting:

nlm --debug list
nlm --debug auth --profile "Work Profile"

Testing

# Run unit tests
go test ./...

# Run integration tests (requires credentials)
go test -tags=integration ./...

# Run CLI tests
go test ./cmd/nlm

πŸ› οΈ Development

Project Structure

β”œβ”€β”€ cmd/nlm/              # CLI application
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ api/              # NotebookLM API client
β”‚   β”œβ”€β”€ auth/             # Browser-based authentication
β”‚   β”œβ”€β”€ batchexecute/     # Google BatchExecute protocol
β”‚   └── httprr/           # HTTP record/replay for testing
β”œβ”€β”€ gen/                  # Generated protobuf code
└── proto/                # Protocol buffer definitions

Building

# Build for current platform
go build ./cmd/nlm

# Build for multiple platforms
GOOS=linux go build ./cmd/nlm
GOOS=windows go build ./cmd/nlm
GOOS=darwin go build ./cmd/nlm

πŸ”’ Security & Privacy

  • Local Authentication: Tokens stored securely in ~/.nlm/env
  • Browser Integration: Uses existing browser sessions, no password storage
  • Profile Isolation: Copies essential browser data only, preserves privacy
  • No Data Collection: Tool operates entirely locally with direct Google API calls

πŸ› Troubleshooting

Common Issues

Authentication fails:

# Try with debug output
nlm auth --debug

# Try different browser profile
nlm auth --all --notebooks

# Use manual authentication
nlm auth --keep-open 60

Network errors:

# Check connection
nlm hb

# Refresh credentials
nlm refresh

Getting Help

  1. Check the debug output: nlm --debug <command>
  2. Verify authentication: nlm auth --debug
  3. Test connectivity: nlm hb
  4. Submit feedback: nlm feedback "Describe your issue"

🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass: go test ./...
  5. Submit a pull request

Development Guidelines

  • Follow standard Go conventions (gofmt)
  • Add comprehensive tests for new features
  • Update documentation for user-facing changes
  • Use conventional commit messages

πŸ“„ License

MIT License - see LICENSE for details.

πŸ™ Acknowledgments

  • Built on Google's NotebookLM platform
  • Powered by Google's Batchexecute API protocol
  • Inspired by the need for efficient notebook management workflows

About

a command line interface to NotebookLM

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages