π¨ Fork Notice
This repository is a personal fork of tmc/nlm, an experimental command-line interface for Google's NotebookLM.
The purpose of this fork is to:
- Fix JSON unmarshaling issues affecting
nlm list- Improve cross-platform compatibility and usability
- Extend functionality for podcast automation and terminal workflows
nlm is a command-line interface for Google's NotebookLM, allowing you to manage notebooks, sources, and audio overviews from your terminal.
π Listen to an Audio Overview of this tool here: https://notebooklm.google.com/notebook/437c839c-5a24-455b-b8da-d35ba8931811/audio.
git clone https://github.com/chenle02/nlm
cd nlm
go install ./cmd/nlmThe nlm binary will be installed to $(go env GOPATH)/bin. Ensure this directory is included in your PATH:
export PATH="$(go env GOPATH)/bin:$PATH"Usage: nlm <command> [arguments]
Notebook Commands:
list, ls List all notebooks
create <title> Create a new notebook
rm <id> Delete a notebook
analytics <id> Show notebook analytics
Source Commands:
sources <id> List sources in notebook
add <id> <input> Add source to notebook
rm-source <id> <source-id> Remove source
rename-source <source-id> <new-name> Rename source
refresh-source <source-id> Refresh source content
check-source <source-id> Check source freshness
Note Commands:
notes <id> List notes in notebook
new-note <id> <title> Create new note
edit-note <id> <note-id> <content> Edit note
rm-note <note-id> Remove note
Audio Commands:
audio-create <id> <instructions> Create audio overview
audio-get <id> Get audio overview
audio-rm <id> Delete audio overview
audio-share <id> Share audio overview
Video Commands:
video-create <id> <instructions> Create video overview
video-get <id> Get video overview
video-rm <id> Delete video overview
Generation Commands:
generate-guide <id> Generate notebook guide
generate-outline <id> Generate content outline
generate-section <id> Generate new section
Other Commands:
auth Setup authenticationπ¦ Installing Go (if needed)
macOS (using Homebrew):
brew install goLinux (Ubuntu/Debian):
sudo apt update
sudo apt install golangLinux (Fedora):
sudo dnf install golang- Visit the Go Downloads page
- Download the appropriate version for your OS
- Follow the installation instructions:
macOS:
- Download the .pkg file
- Double-click to install
- Follow the installer prompts
Linux:
# Example for Linux AMD64 (adjust version as needed)
wget https://go.dev/dl/go1.21.6.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.21.6.linux-amd64.tar.gzAdd Go to your PATH by adding these lines to your ~/.bashrc, ~/.zshrc, or equivalent:
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:$(go env GOPATH)/binVerify installation:
go versionFirst, authenticate with your Google account:
nlm authThis will launch Chrome to authenticate with your Google account. The authentication tokens will be saved in ~/.nlm/env file.
If you encounter issues during authentication, try using debug mode for additional troubleshooting information:
nlm -debug authNote: Authentication has been tested and confirmed working on Ubuntu Linux. The tool will automatically launch Chrome in the background to handle the Google OAuth flow.
# List all notebooks
nlm list
# Create a new notebook
nlm create "My Research Notes"
# Delete a notebook
nlm rm <notebook-id>
# Get notebook analytics
nlm analytics <notebook-id># List sources in a notebook
nlm sources <notebook-id>
# Add a source from URL
nlm add <notebook-id> https://example.com/article
# Add a source from file
nlm add <notebook-id> document.pdf
# Add source from stdin
echo "Some text" | nlm add <notebook-id> -
# Rename a source
nlm rename-source <source-id> "New Title"
# Remove a source
nlm rm-source <notebook-id> <source-id># List notes in a notebook
nlm notes <notebook-id>
# Create a new note
nlm new-note <notebook-id> "Note Title"
# Edit a note
nlm edit-note <notebook-id> <note-id> "New content"
# Remove a note
nlm rm-note <note-id># Create an audio overview
nlm audio-create <notebook-id> "speak in a professional tone"
# Get audio overview status/content
nlm audio-get <notebook-id>
# Share audio overview (private)
nlm audio-share <notebook-id>
# Share audio overview (public)
nlm audio-share <notebook-id> --public# Create a video overview
nlm video-create <notebook-id> "create engaging visual explanation"
# Get video overview status/content
nlm video-get <notebook-id>
# Delete video overview
nlm video-rm <notebook-id>Note: Video overview functionality requires discovery of the actual NotebookLM RPC endpoints. Currently, the video commands are implemented but will show an informative error message until the correct RPC endpoint IDs are discovered through network inspection of the NotebookLM web interface.
Create a notebook and add some content:
# Create a new notebook
notebook_id=$(nlm create "Research Notes" | grep -o 'notebook [^ ]*' | cut -d' ' -f2)
# Add some sources
nlm add $notebook_id https://example.com/research-paper
nlm add $notebook_id research-data.pdf
# Create an audio overview
nlm audio-create $notebook_id "summarize in a professional tone"
# Create a video overview
nlm video-create $notebook_id "create visual presentation with key insights"
# Check the audio overview
nlm audio-get $notebook_id
# Check the video overview
nlm video-get $notebook_idFor automated PDF processing, use the included workflow script:
# Run the automated workflow
./scripts/nlm_workflow.sh document.pdfWhat it does:
- Creates a notebook named after the PDF file (if it doesn't exist)
- Uploads the PDF as a source to the notebook
- Generates an audio overview automatically
- Downloads the audio file to the current directory as
document.wav
Features:
- β Smart duplicate detection - skips processing if notebook already exists
- β Robust upload with retry logic and verification
- β Automatic polling for audio readiness
- β Clean output with timestamped logging
Example usage:
# Process a research paper
./scripts/nlm_workflow.sh research-paper-2024.pdf
# The script will:
# 1. Create notebook "research-paper-2024"
# 2. Upload the PDF
# 3. Generate audio overview
# 4. Save as "research-paper-2024.wav"Requirements:
- nlm CLI must be installed and authenticated (
nlm auth) - Standard Unix tools:
grep,sed,head,mktemp
Add -debug flag to see detailed API interactions:
nlm -debug listNLM_AUTH_TOKEN: Authentication token (stored in ~/.nlm/env)NLM_COOKIES: Authentication cookies (stored in ~/.nlm/env)NLM_BROWSER_PROFILE: Chrome profile to use for authentication (default: "Default")
These are typically managed by the auth command, but can be manually configured if needed.
Contributions are welcome! Please feel free to submit a Pull Request.
- β
Fixed multi-chunk response decoding in
nlm list - β Fixed infinite recursion bug in batchexecute response parsing
- β Improved authentication timeout handling and reliability
- β Added custom parser for NotebookLM API response format changes
- β Confirmed working authentication on Ubuntu Linux with debug mode support
- β
Added Video Overview functionality framework (
video-create,video-get,video-rm)- Framework ready for easy endpoint discovery and integration
- Informative error messages explaining current limitations
MIT License - see LICENSE for details.