Skip to content

romular21/obsidian-notebooklm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Obsidian → NotebookLM Adapter

Automatically sync your Obsidian vault folders to Google Docs for seamless integration with Google NotebookLM.

Obsidian vault (.md files)
       ↓ [automatic on changes]
   Google Doc (aggregated)
       ↓ [one-click Sync]
   NotebookLM

Why?

NotebookLM is great for AI-powered Q&A over your documents, but it doesn't support direct Obsidian integration. Sources are static snapshots that need manual re-uploading.

This adapter bridges the gap:

  • Watches your Obsidian folders for changes
  • Aggregates all markdown files into a Google Doc
  • Auto-updates the Doc when files change
  • In NotebookLM, just click Sync to refresh

Features

  • 🔄 Real-time watching — detects file changes instantly
  • 📁 Multi-target support — different folders → different Google Docs
  • 🔐 Private & secure — uses your own Google Cloud credentials
  • 💾 Smart sync — only updates when content actually changes
  • ⏱️ Debouncing — prevents spam updates on bulk changes
  • 🖥️ Cross-platform — works on Windows, macOS, Linux

Quick Start

1. Set up Google Cloud (one-time)

  1. Go to Google Cloud Console
  2. Create a new project (or select existing)
  3. Enable Google Docs API:
    • Menu → APIs & Services → Library
    • Search "Google Docs API" → Enable
  4. Create OAuth credentials:
    • APIs & Services → Credentials → Create Credentials → OAuth client ID
    • Application type: Desktop app
    • Download JSON → rename to credentials.json
    • Place in the adapter directory

2. Create a Google Doc

  1. Create an empty Google Doc: docs.new
  2. Copy the Doc ID from URL:
    https://docs.google.com/document/d/[THIS_IS_THE_ID]/edit
    

3. Install

git clone https://github.com/YOUR_USERNAME/obsidian-notebooklm-adapter.git
cd obsidian-notebooklm-adapter
pip install -r requirements.txt

4. Configure

Copy the example config and edit:

cp config.example.yaml config.yaml

Single target:

vault_path: ~/Documents/MyVault
folders:
  - Projects
  - Notes
doc_id: YOUR_GOOGLE_DOC_ID

Multiple targets:

vault_path: ~/Documents/MyVault

targets:
  - name: Work
    doc_id: DOC_ID_1
    folders:
      - Projects
      - Meetings

  - name: Personal
    doc_id: DOC_ID_2
    folders:
      - Journal
      - Ideas

5. Run

python adapter.py --config config.yaml

First run will open a browser for Google authentication.

Usage with NotebookLM

  1. Start the adapter (runs in background)
  2. Add your Google Doc as a source in NotebookLM
  3. Edit your Obsidian notes normally
  4. In NotebookLM, click the source → "Click to sync with Google Drive"

NotebookLM will show "Checking freshness" and update the content.

Command Line Options

Option Description
--config, -c Path to YAML config file
--vault, -v Path to Obsidian vault
--folders, -f Comma-separated folders
--doc-id, -d Google Doc ID
--credentials Path to credentials.json (default: credentials.json)
--once Sync once and exit (no watching)
--debounce Debounce seconds (default: 2)

Document Structure

The adapter creates a structured document:

# Obsidian Vault Export
**Updated:** 2025-01-13 15:30:45
**Files:** 42
**Folders:** Projects, Notes

---

## 📄 Projects/my-project.md

[file contents]

---

## 📄 Notes/idea.md

[file contents]

Limits

NotebookLM source limits:

  • 500,000 words per source (free tier)
  • 50 sources per notebook (free) / 300 sources (Plus)

The adapter shows character count on each sync so you can monitor usage.

Auto-start

macOS (launchd)

Create ~/Library/LaunchAgents/com.obsidian.notebooklm.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.obsidian.notebooklm</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/python3</string>
        <string>/path/to/adapter.py</string>
        <string>--config</string>
        <string>/path/to/config.yaml</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
</dict>
</plist>
launchctl load ~/Library/LaunchAgents/com.obsidian.notebooklm.plist

Windows (Task Scheduler)

  1. Open Task Scheduler
  2. Create Basic Task
  3. Trigger: At log on
  4. Action: Start a program
    • Program: python
    • Arguments: C:\path\to\adapter.py --config C:\path\to\config.yaml

Linux (systemd)

Create ~/.config/systemd/user/obsidian-notebooklm.service:

[Unit]
Description=Obsidian to NotebookLM Adapter

[Service]
ExecStart=/usr/bin/python3 /path/to/adapter.py --config /path/to/config.yaml
Restart=always

[Install]
WantedBy=default.target
systemctl --user enable --now obsidian-notebooklm

Troubleshooting

"Missing credentials.json" Download OAuth credentials from Google Cloud Console.

"Token has been expired or revoked" Delete token.json and run again — browser will open for re-auth.

"The caller does not have permission"

  • Ensure you own the Google Doc or have edit access
  • Verify Google Docs API is enabled in Cloud Console

Files not updating

  • Check folders exist in vault
  • Ensure files have .md extension
  • Check console for errors

Security

  • credentials.json — your app's OAuth config (safe to keep private)
  • token.jsoncontains your access token — never commit to git!

The .gitignore excludes sensitive files by default.

Contributing

PRs welcome! Some ideas:

  • Support for other file types (.txt, .pdf)
  • Selective sync by tags
  • Web UI for configuration
  • Multiple vault support

License

MIT — see LICENSE

Acknowledgments

Built with help from Claude (Anthropic) during a late-night hacking session.

About

Sync Obsidian vault to NotebookLM

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages