A Python tool that automates Google NotebookLM operations using Playwright and Chrome DevTools Protocol (CDP).
NotebookLM Automator is designed to automate the following operations in Google NotebookLM:
- Creating new notebooks
- Adding website and YouTube URLs as sources to notebooks
- Starting Audio Overview (podcast) generation
- Uploading generated podcasts to Spotify
This tool uses Playwright for browser automation and connects to an existing Chrome browser via Chrome DevTools Protocol (CDP). It is based on DataNath/notebooklm_source_automation with enhancements including improved authentication method, Audio Overview generation capability, Spotify integration, and modernized project structure.
The Spotify Uploader feature allows you to automatically upload your generated podcasts to Spotify. Key features include:
- Automatic Spotify login using existing credentials
- Podcast metadata management (title, description, etc.)
- Cover art upload support
- Episode publishing with proper categorization
- Progress tracking and error handling
To use the Spotify Uploader, you'll need a Spotify for Podcasters account and the necessary permissions to publish podcasts.
- uv
- Python 3.9 or higher
- Chrome or Chromium browser
-
Install
uvFollow the official installation instructions at https://github.com/astral-sh/uv or install with pip:
pip install uv
-
Clone the repository
git clone <repository-url> cd notebooklm-automator
-
Create and activate a virtual environment
uv venv source .venv/bin/activate # macOS/Linux # .venv\Scripts\activate # Windows
-
Install dependencies and the project in editable mode
uv pip install -e .
IMPORTANT: Before running the script, you must launch Chrome/Chromium with remote debugging enabled.
macOS:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir=./chrome-user-data --window-size=1280,800Windows:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir=./chrome-user-data --window-size=1280,800Linux:
google-chrome --remote-debugging-port=9222 --user-data-dir=./chrome-user-data --window-size=1280,800The default port is 9222, but you can use a different port and specify it with the -p flag when running the automator.
The --user-data-dir=./chrome-user-data parameter creates a separate Chrome profile for this automation, which helps avoid conflicts with your regular browsing sessions and ensures a clean environment for the automation to run.
Note about Google login: When you first launch Chrome with this parameter, you'll need to log in to your Google account to access NotebookLM. However, for subsequent launches with the same --user-data-dir path, your login session will be preserved, and you won't need to log in again. This makes the automation process much smoother after the initial setup.
Important: Make sure your Chrome window is at least 1261 pixels wide. NotebookLM requires sufficient width to display its 3-column layout correctly. The automation tool will attempt to set the viewport size automatically, but having a properly sized browser window helps ensure the UI elements are in their expected positions.
Ensure your virtual environment is activated and Chrome is running with remote debugging enabled.
The Streamlit interface is the recommended way to use this tool as it provides a user-friendly experience with visual feedback on the automation progress.
streamlit run src/notebooklm_automator/streamlit_app.pyYou can also run the NotebookLM and Spotify functionalities as separate applications:
For NotebookLM podcast creation only:
streamlit run src/notebooklm_automator/notebooklm_streamlit_app.pyFor Spotify upload only:
streamlit run src/notebooklm_automator/spotify_streamlit_app.pyThese will launch web interfaces at http://localhost:8501 where you can:
- Enter URLs directly in a text area
- Upload a file containing URLs
- Configure the CDP port
- Enable Jina Reader API for better content extraction (NotebookLM app only)
- Monitor the automation progress with a visual interface and real-time logs
- See clear success/error messages with troubleshooting guidance
While the Streamlit interface is recommended for most users, the following command-line options are available for advanced users or automation scenarios.
run-automator -u "https://example.com,https://www.youtube.com/watch?v=dQw4w9WgXcQ"run-automator urls.txtThe file should contain one URL per line.
run-automatorThe script will prompt you to enter URLs one per line. After entering your URLs, press:
- Ctrl+D on Linux/macOS
- Ctrl+Z followed by Enter on Windows
You'll see confirmation of each URL as you enter it, making it easier to verify your input.
cat urls.txt | run-automator echo -e "https://example.com\nhttps://example.org" | run-automatorrun-automator -p 9223 -u "https://example.com" run-automator -p 9223 urls.txtfile: Optional file containing URLs (one per line).-u, --urls URLS: Comma-separated list of website or YouTube URLs.-p, --port PORT: CDP port for Chrome connection (default: 9222). Only change this if you started Chrome with a different remote debugging port.-j, --jina-reader: Use Jina Reader API by prepending "https://r.jina.ai/" to URLs. This can improve content extraction for some websites.
If no file or URLs are provided, the script will read from standard input (either from a pipe or interactively).
# With URL flag run-automator -j -u "https://example.com" # With file run-automator -j urls.txt # With stdin cat urls.txt | run-automator -j- NotebookLM's UI is subject to change, which could break the Playwright selectors. Regular maintenance might be needed.
- The script initiates Audio Overview generation but does not wait for its completion.
