notebooklm-mindmap-extractor 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- notebooklm_mindmap_extractor-0.1.0/LICENSE +21 -0
- notebooklm_mindmap_extractor-0.1.0/MANIFEST.in +2 -0
- notebooklm_mindmap_extractor-0.1.0/PKG-INFO +198 -0
- notebooklm_mindmap_extractor-0.1.0/README.md +172 -0
- notebooklm_mindmap_extractor-0.1.0/pyproject.toml +43 -0
- notebooklm_mindmap_extractor-0.1.0/requirements.txt +1 -0
- notebooklm_mindmap_extractor-0.1.0/setup.cfg +4 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor/__init__.py +7 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor/__main__.py +3 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor/builder.py +380 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor/cleaner.py +290 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor/cli.py +301 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor/extractor.py +401 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor/hierarchy.py +72 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor/models.py +17 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor.egg-info/PKG-INFO +198 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor.egg-info/SOURCES.txt +26 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor.egg-info/dependency_links.txt +1 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor.egg-info/entry_points.txt +2 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor.egg-info/requires.txt +6 -0
- notebooklm_mindmap_extractor-0.1.0/src/notebooklm_mindmap_extractor.egg-info/top_level.txt +1 -0
- notebooklm_mindmap_extractor-0.1.0/tests/fixtures/run/doc_full_order.yml +163 -0
- notebooklm_mindmap_extractor-0.1.0/tests/fixtures/run/tmp/Academic Research & Reference Management/Overview.txt +255 -0
- notebooklm_mindmap_extractor-0.1.0/tests/fixtures/run/tmp/Overview.txt +283 -0
- notebooklm_mindmap_extractor-0.1.0/tests/test_cleaner.py +71 -0
- notebooklm_mindmap_extractor-0.1.0/tests/test_hierarchy.py +39 -0
- notebooklm_mindmap_extractor-0.1.0/tests/test_real_run.py +49 -0
- notebooklm_mindmap_extractor-0.1.0/tests/test_run_pipeline.py +71 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jack Lichwa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: notebooklm-mindmap-extractor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Compile NotebookLM mindmaps and generated responses into Markdown using Chrome CDP.
|
|
5
|
+
Author-email: Jack Lichwa <jacklichwa@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/JLichwa80/notebooklm-mindmap-extractor
|
|
8
|
+
Project-URL: Repository, https://github.com/JLichwa80/notebooklm-mindmap-extractor
|
|
9
|
+
Project-URL: Issues, https://github.com/JLichwa80/notebooklm-mindmap-extractor/issues
|
|
10
|
+
Keywords: notebooklm,mindmap,markdown,playwright,chrome-devtools-protocol
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: playwright>=1.64.1
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
24
|
+
Requires-Dist: twine>=5; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# NotebookLM Mindmap Extractor
|
|
28
|
+
|
|
29
|
+
Compile a NotebookLM mindmap and its generated responses into a hierarchical Markdown document using Playwright and Chrome DevTools Protocol (CDP).
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
Requires Python 3.10 or newer, Playwright 1.64.1 or newer, and Chrome.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install notebooklm-mindmap-extractor
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or from a checkout:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python -m venv .venv
|
|
43
|
+
# Windows PowerShell
|
|
44
|
+
.\.venv\Scripts\Activate.ps1
|
|
45
|
+
# macOS/Linux: source .venv/bin/activate
|
|
46
|
+
python -m pip install -e ".[dev]"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For an existing wheel, use `python -m pip install dist/<wheel-filename>.whl`.
|
|
50
|
+
The package installs the `notebooklm-mindmap-extractor` command. The module entry point is `python -m notebooklm_mindmap_extractor`.
|
|
51
|
+
|
|
52
|
+
## Prepare Chrome
|
|
53
|
+
|
|
54
|
+
Launch Chrome with a dedicated data directory and a local debugging port. Sign in to Google manually in that browser, open your notebook, and open the target mindmap. The extractor attaches to this session; it does not automate sign-in.
|
|
55
|
+
|
|
56
|
+
Windows PowerShell (adjust the executable path if needed):
|
|
57
|
+
|
|
58
|
+
```powershell
|
|
59
|
+
& 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' --remote-debugging-port=9222 --remote-debugging-address=127.0.0.1 --user-data-dir="$env:LOCALAPPDATA\NotebookLMMindmapChrome"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
macOS:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' --remote-debugging-port=9222 --user-data-dir="$HOME/.notebooklm-mindmap-chrome"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Linux:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
google-chrome --remote-debugging-port=9222 --user-data-dir="$HOME/.notebooklm-mindmap-chrome"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Chrome 136 and newer require a non-default data directory for remote debugging. See [Chrome's remote debugging guidance](https://developer.chrome.com/blog/remote-debugging-port). Keep the endpoint local and exclude profiles and private exports from source control.
|
|
75
|
+
|
|
76
|
+
## Extract
|
|
77
|
+
|
|
78
|
+
With the target mindmap already open:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
notebooklm-mindmap-extractor --output output/mindmap.md
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Select a particular notebook and open a map by its exact visible title:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
notebooklm-mindmap-extractor --notebook "Token Buffet" --mindmap-title "Token MindMap" --max-nodes 1 --output output/token-smoke.md
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Both `notebook.google.com` and `notebooklm.google.com` notebook links, IDs, and titles are accepted.
|
|
91
|
+
|
|
92
|
+
| Option | Default | Purpose |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| `--cdp-url` | `http://localhost:9222` | Attach to a running Chrome session |
|
|
95
|
+
| `--notebook` | (Required for extraction) | Select notebook by ID, title, or URL |
|
|
96
|
+
| `--mindmap-title` | (Required for extraction) | Click the exact visible map title |
|
|
97
|
+
| `--output` | `None` (compiled via `--build`) | UTF-8 Markdown destination |
|
|
98
|
+
| `--folder-output` | `handbook` | Save docs in versioned node folder hierarchy |
|
|
99
|
+
| `--extract-only` | `False` | Only capture raw text into `<run>/tmp`; clean later with `--clean` |
|
|
100
|
+
| `--clean` | `None` | Offline: clean the saved raw `.txt` files of a run folder (or its `tmp` folder) into `.md` files |
|
|
101
|
+
| `--build` | `None` | Recompile document from run folder offline (supports relative path) |
|
|
102
|
+
| `--outline` | `doc_full_order.yml` in run dir | Custom order YAML for document compilation |
|
|
103
|
+
| `--wait-timeout` | `120` | Maximum response wait in seconds per node |
|
|
104
|
+
| `--max-nodes` | All discovered nodes | Limit generation for smoke testing |
|
|
105
|
+
| `--dry-run` | `False` | Fast structure test without waiting for chat generations |
|
|
106
|
+
|
|
107
|
+
## Two steps: capture, then clean
|
|
108
|
+
|
|
109
|
+
Extraction runs in two steps so you never have to re-extract to adjust the output.
|
|
110
|
+
|
|
111
|
+
1. **Capture** saves each node's text exactly as the page shows it, with no processing, to `<run>/tmp/`. The `.txt` files mirror the folder layout of the final `.md` files (`Overview.txt` for the root and for nodes with children, `<title>.txt` for leaves).
|
|
112
|
+
2. **Clean** (`cleaner.py`) reads those files and writes the `.md` files next to `tmp/`. It removes citations, page icons and the follow-up prompt, turns tables into Markdown tables, fences box diagrams, and separates paragraphs.
|
|
113
|
+
|
|
114
|
+
A normal run does both. To do them separately:
|
|
115
|
+
|
|
116
|
+
```powershell
|
|
117
|
+
# capture only
|
|
118
|
+
notebooklm-mindmap-extractor --notebook "My Notebook" --mindmap-title "My Map" --extract-only
|
|
119
|
+
|
|
120
|
+
# clean from the saved raw files, as often as needed, with no browser
|
|
121
|
+
notebooklm-mindmap-extractor --clean handbook/my-notebook/my-map-20261028_152843
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The page text carries no markup, so bold, bullets and heading markers are not available; headings and list items arrive as plain paragraphs. `--build` only combines the cleaned `.md` files into one document and does no cleaning.
|
|
125
|
+
|
|
126
|
+
## Recompiling from Nodes and Customizing with doc_full_order.yml
|
|
127
|
+
|
|
128
|
+
Extraction automatically saves a `doc_full_order.yml` file inside your versioned run directory under `--folder-output`. It establishes the parent and child hierarchy with explicit `order:` attributes:
|
|
129
|
+
|
|
130
|
+
```yaml
|
|
131
|
+
- nodeTitle: "Token Buffet AI Subscription Hub"
|
|
132
|
+
childNodes:
|
|
133
|
+
- title: "Core Architecture"
|
|
134
|
+
order: 1
|
|
135
|
+
- title: "Smart Routing & Tiers"
|
|
136
|
+
order: 2
|
|
137
|
+
|
|
138
|
+
- nodeTitle: "Core Architecture"
|
|
139
|
+
childNodes:
|
|
140
|
+
- title: "Proxy Runtime: Standard HTTP server"
|
|
141
|
+
order: 1
|
|
142
|
+
- title: "Local Router: Port 8090"
|
|
143
|
+
order: 2
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
You can edit this file to change order numbers, reorder items, or omit sections.
|
|
147
|
+
|
|
148
|
+
To recompile the unified document offline using a relative path, without launching Chrome or NotebookLM:
|
|
149
|
+
|
|
150
|
+
```powershell
|
|
151
|
+
python -m notebooklm_mindmap_extractor --build handbook/token-buffet-ai-subscription-hub-20261027_175222
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Or using a custom outline file:
|
|
155
|
+
|
|
156
|
+
```powershell
|
|
157
|
+
python -m notebooklm_mindmap_extractor --build handbook/token-buffet-ai-subscription-hub-20261027_175222 --outline custom_order.yml --output output/custom_mindmap.md
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Extraction clicks nodes and triggers NotebookLM generation. A missing or stale response causes a nonzero exit instead of a success placeholder. The output is written after all requested nodes complete.
|
|
161
|
+
|
|
162
|
+
## Development and tests
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
python -m pip install -e ".[dev]"
|
|
166
|
+
python -m playwright install chromium
|
|
167
|
+
python -m pytest
|
|
168
|
+
python -m build
|
|
169
|
+
python -m twine check dist/*
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Tests cover hierarchy reconstruction, the cleaner, and the capture-then-clean pipeline on a saved real extraction (`tests/fixtures/run/`). They do not contact Google or need a browser.
|
|
173
|
+
|
|
174
|
+
`python -m build` creates a source archive and wheel in `dist/`. Packaging follows the [Python Packaging User Guide](https://packaging.python.org/en/latest/tutorials/packaging-projects/). The package is MIT licensed (see `LICENSE`). Releases are published to PyPI by `.github/workflows/publish.yml` when a GitHub Release is published, using Trusted Publishing.
|
|
175
|
+
|
|
176
|
+
## Project layout
|
|
177
|
+
|
|
178
|
+
```text
|
|
179
|
+
pyproject.toml Package metadata, dependencies, console entry point
|
|
180
|
+
src/notebooklm_mindmap_extractor/
|
|
181
|
+
__init__.py Public data model and hierarchy helper
|
|
182
|
+
__main__.py python -m entry point
|
|
183
|
+
cli.py Arguments and extraction orchestration
|
|
184
|
+
extractor.py Raw capture to tmp/, then the clean step per node
|
|
185
|
+
cleaner.py Cleaning of the raw page text
|
|
186
|
+
builder.py doc_full_order.yml and combining the .md files
|
|
187
|
+
hierarchy.py Parent-child reconstruction
|
|
188
|
+
models.py MindmapNode dataclass
|
|
189
|
+
tests/ Unit tests and a saved real extraction (fixtures/run)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The former root script is replaced by the installed console and module commands. `requirements.txt` remains an editable-install shortcut.
|
|
193
|
+
|
|
194
|
+
## Current limitations
|
|
195
|
+
|
|
196
|
+
The extractor supports mindmap trees rendered directly in the notebook or inside the embedded Studio App viewer. Wait for the viewer to finish loading before starting. Node clicks occur inside the map frame while generated answers are captured from the notebook chat panel. The command leaves the signed-in browser open and never reloads the notebook.
|
|
197
|
+
|
|
198
|
+
NotebookLM selectors may need updates when Google's UI changes. Only rendered nodes are discovered; collapsed branches are not automatically expanded. Complete accessibility levels use DOM preorder. Coordinate inference assumes a left-to-right map and uses the nearest parent vertically, so inspect the resulting hierarchy. Markdown headings are capped at six levels. A live test against a signed-in notebook is separate from the local fixture tests.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# NotebookLM Mindmap Extractor
|
|
2
|
+
|
|
3
|
+
Compile a NotebookLM mindmap and its generated responses into a hierarchical Markdown document using Playwright and Chrome DevTools Protocol (CDP).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Requires Python 3.10 or newer, Playwright 1.64.1 or newer, and Chrome.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install notebooklm-mindmap-extractor
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or from a checkout:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
python -m venv .venv
|
|
17
|
+
# Windows PowerShell
|
|
18
|
+
.\.venv\Scripts\Activate.ps1
|
|
19
|
+
# macOS/Linux: source .venv/bin/activate
|
|
20
|
+
python -m pip install -e ".[dev]"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
For an existing wheel, use `python -m pip install dist/<wheel-filename>.whl`.
|
|
24
|
+
The package installs the `notebooklm-mindmap-extractor` command. The module entry point is `python -m notebooklm_mindmap_extractor`.
|
|
25
|
+
|
|
26
|
+
## Prepare Chrome
|
|
27
|
+
|
|
28
|
+
Launch Chrome with a dedicated data directory and a local debugging port. Sign in to Google manually in that browser, open your notebook, and open the target mindmap. The extractor attaches to this session; it does not automate sign-in.
|
|
29
|
+
|
|
30
|
+
Windows PowerShell (adjust the executable path if needed):
|
|
31
|
+
|
|
32
|
+
```powershell
|
|
33
|
+
& 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' --remote-debugging-port=9222 --remote-debugging-address=127.0.0.1 --user-data-dir="$env:LOCALAPPDATA\NotebookLMMindmapChrome"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
macOS:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' --remote-debugging-port=9222 --user-data-dir="$HOME/.notebooklm-mindmap-chrome"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Linux:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
google-chrome --remote-debugging-port=9222 --user-data-dir="$HOME/.notebooklm-mindmap-chrome"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Chrome 136 and newer require a non-default data directory for remote debugging. See [Chrome's remote debugging guidance](https://developer.chrome.com/blog/remote-debugging-port). Keep the endpoint local and exclude profiles and private exports from source control.
|
|
49
|
+
|
|
50
|
+
## Extract
|
|
51
|
+
|
|
52
|
+
With the target mindmap already open:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
notebooklm-mindmap-extractor --output output/mindmap.md
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Select a particular notebook and open a map by its exact visible title:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
notebooklm-mindmap-extractor --notebook "Token Buffet" --mindmap-title "Token MindMap" --max-nodes 1 --output output/token-smoke.md
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Both `notebook.google.com` and `notebooklm.google.com` notebook links, IDs, and titles are accepted.
|
|
65
|
+
|
|
66
|
+
| Option | Default | Purpose |
|
|
67
|
+
| --- | --- | --- |
|
|
68
|
+
| `--cdp-url` | `http://localhost:9222` | Attach to a running Chrome session |
|
|
69
|
+
| `--notebook` | (Required for extraction) | Select notebook by ID, title, or URL |
|
|
70
|
+
| `--mindmap-title` | (Required for extraction) | Click the exact visible map title |
|
|
71
|
+
| `--output` | `None` (compiled via `--build`) | UTF-8 Markdown destination |
|
|
72
|
+
| `--folder-output` | `handbook` | Save docs in versioned node folder hierarchy |
|
|
73
|
+
| `--extract-only` | `False` | Only capture raw text into `<run>/tmp`; clean later with `--clean` |
|
|
74
|
+
| `--clean` | `None` | Offline: clean the saved raw `.txt` files of a run folder (or its `tmp` folder) into `.md` files |
|
|
75
|
+
| `--build` | `None` | Recompile document from run folder offline (supports relative path) |
|
|
76
|
+
| `--outline` | `doc_full_order.yml` in run dir | Custom order YAML for document compilation |
|
|
77
|
+
| `--wait-timeout` | `120` | Maximum response wait in seconds per node |
|
|
78
|
+
| `--max-nodes` | All discovered nodes | Limit generation for smoke testing |
|
|
79
|
+
| `--dry-run` | `False` | Fast structure test without waiting for chat generations |
|
|
80
|
+
|
|
81
|
+
## Two steps: capture, then clean
|
|
82
|
+
|
|
83
|
+
Extraction runs in two steps so you never have to re-extract to adjust the output.
|
|
84
|
+
|
|
85
|
+
1. **Capture** saves each node's text exactly as the page shows it, with no processing, to `<run>/tmp/`. The `.txt` files mirror the folder layout of the final `.md` files (`Overview.txt` for the root and for nodes with children, `<title>.txt` for leaves).
|
|
86
|
+
2. **Clean** (`cleaner.py`) reads those files and writes the `.md` files next to `tmp/`. It removes citations, page icons and the follow-up prompt, turns tables into Markdown tables, fences box diagrams, and separates paragraphs.
|
|
87
|
+
|
|
88
|
+
A normal run does both. To do them separately:
|
|
89
|
+
|
|
90
|
+
```powershell
|
|
91
|
+
# capture only
|
|
92
|
+
notebooklm-mindmap-extractor --notebook "My Notebook" --mindmap-title "My Map" --extract-only
|
|
93
|
+
|
|
94
|
+
# clean from the saved raw files, as often as needed, with no browser
|
|
95
|
+
notebooklm-mindmap-extractor --clean handbook/my-notebook/my-map-20261028_152843
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The page text carries no markup, so bold, bullets and heading markers are not available; headings and list items arrive as plain paragraphs. `--build` only combines the cleaned `.md` files into one document and does no cleaning.
|
|
99
|
+
|
|
100
|
+
## Recompiling from Nodes and Customizing with doc_full_order.yml
|
|
101
|
+
|
|
102
|
+
Extraction automatically saves a `doc_full_order.yml` file inside your versioned run directory under `--folder-output`. It establishes the parent and child hierarchy with explicit `order:` attributes:
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
- nodeTitle: "Token Buffet AI Subscription Hub"
|
|
106
|
+
childNodes:
|
|
107
|
+
- title: "Core Architecture"
|
|
108
|
+
order: 1
|
|
109
|
+
- title: "Smart Routing & Tiers"
|
|
110
|
+
order: 2
|
|
111
|
+
|
|
112
|
+
- nodeTitle: "Core Architecture"
|
|
113
|
+
childNodes:
|
|
114
|
+
- title: "Proxy Runtime: Standard HTTP server"
|
|
115
|
+
order: 1
|
|
116
|
+
- title: "Local Router: Port 8090"
|
|
117
|
+
order: 2
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
You can edit this file to change order numbers, reorder items, or omit sections.
|
|
121
|
+
|
|
122
|
+
To recompile the unified document offline using a relative path, without launching Chrome or NotebookLM:
|
|
123
|
+
|
|
124
|
+
```powershell
|
|
125
|
+
python -m notebooklm_mindmap_extractor --build handbook/token-buffet-ai-subscription-hub-20261027_175222
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Or using a custom outline file:
|
|
129
|
+
|
|
130
|
+
```powershell
|
|
131
|
+
python -m notebooklm_mindmap_extractor --build handbook/token-buffet-ai-subscription-hub-20261027_175222 --outline custom_order.yml --output output/custom_mindmap.md
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Extraction clicks nodes and triggers NotebookLM generation. A missing or stale response causes a nonzero exit instead of a success placeholder. The output is written after all requested nodes complete.
|
|
135
|
+
|
|
136
|
+
## Development and tests
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
python -m pip install -e ".[dev]"
|
|
140
|
+
python -m playwright install chromium
|
|
141
|
+
python -m pytest
|
|
142
|
+
python -m build
|
|
143
|
+
python -m twine check dist/*
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Tests cover hierarchy reconstruction, the cleaner, and the capture-then-clean pipeline on a saved real extraction (`tests/fixtures/run/`). They do not contact Google or need a browser.
|
|
147
|
+
|
|
148
|
+
`python -m build` creates a source archive and wheel in `dist/`. Packaging follows the [Python Packaging User Guide](https://packaging.python.org/en/latest/tutorials/packaging-projects/). The package is MIT licensed (see `LICENSE`). Releases are published to PyPI by `.github/workflows/publish.yml` when a GitHub Release is published, using Trusted Publishing.
|
|
149
|
+
|
|
150
|
+
## Project layout
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
pyproject.toml Package metadata, dependencies, console entry point
|
|
154
|
+
src/notebooklm_mindmap_extractor/
|
|
155
|
+
__init__.py Public data model and hierarchy helper
|
|
156
|
+
__main__.py python -m entry point
|
|
157
|
+
cli.py Arguments and extraction orchestration
|
|
158
|
+
extractor.py Raw capture to tmp/, then the clean step per node
|
|
159
|
+
cleaner.py Cleaning of the raw page text
|
|
160
|
+
builder.py doc_full_order.yml and combining the .md files
|
|
161
|
+
hierarchy.py Parent-child reconstruction
|
|
162
|
+
models.py MindmapNode dataclass
|
|
163
|
+
tests/ Unit tests and a saved real extraction (fixtures/run)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The former root script is replaced by the installed console and module commands. `requirements.txt` remains an editable-install shortcut.
|
|
167
|
+
|
|
168
|
+
## Current limitations
|
|
169
|
+
|
|
170
|
+
The extractor supports mindmap trees rendered directly in the notebook or inside the embedded Studio App viewer. Wait for the viewer to finish loading before starting. Node clicks occur inside the map frame while generated answers are captured from the notebook chat panel. The command leaves the signed-in browser open and never reloads the notebook.
|
|
171
|
+
|
|
172
|
+
NotebookLM selectors may need updates when Google's UI changes. Only rendered nodes are discovered; collapsed branches are not automatically expanded. Complete accessibility levels use DOM preorder. Coordinate inference assumes a left-to-right map and uses the nearest parent vertically, so inspect the resulting hierarchy. Markdown headings are capped at six levels. A live test against a signed-in notebook is separate from the local fixture tests.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "notebooklm-mindmap-extractor"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Compile NotebookLM mindmaps and generated responses into Markdown using Chrome CDP."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Jack Lichwa", email = "jacklichwa@gmail.com" },
|
|
15
|
+
]
|
|
16
|
+
keywords = ["notebooklm", "mindmap", "markdown", "playwright", "chrome-devtools-protocol"]
|
|
17
|
+
dependencies = ["playwright>=1.64.1"]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 3 - Alpha",
|
|
20
|
+
"Environment :: Console",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Topic :: Text Processing :: Markup :: Markdown",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://github.com/JLichwa80/notebooklm-mindmap-extractor"
|
|
29
|
+
Repository = "https://github.com/JLichwa80/notebooklm-mindmap-extractor"
|
|
30
|
+
Issues = "https://github.com/JLichwa80/notebooklm-mindmap-extractor/issues"
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = ["build>=1.2", "pytest>=8", "twine>=5"]
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
notebooklm-mindmap-extractor = "notebooklm_mindmap_extractor.cli:main"
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
40
|
+
|
|
41
|
+
[tool.pytest.ini_options]
|
|
42
|
+
testpaths = ["tests"]
|
|
43
|
+
markers = ["browser: local Chromium integration tests (requires playwright install chromium)"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
-e .
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""NotebookLM mindmap extraction and Markdown compilation."""
|
|
2
|
+
|
|
3
|
+
from .builder import build_handbook_from_folder, generate_flattened_outline_yaml, generate_outline_yaml
|
|
4
|
+
from .hierarchy import build_hierarchy
|
|
5
|
+
from .models import MindmapNode
|
|
6
|
+
|
|
7
|
+
__all__ = ["MindmapNode", "build_handbook_from_folder", "build_hierarchy", "generate_flattened_outline_yaml", "generate_outline_yaml"]
|