让 NotebookLM 回到你真正工作的浏览器里。 Bring NotebookLM back to the browser you actually work in.
NotebookLM upgrade path with live Chrome identity reuse via CDP.
google2api-cli 是 notebooklm-cdp-cli 的升级命名版本。
当前仓库主打的是更宽的 Google 工作流入口,但现阶段仍保持 notebooklm / gemini-web / colab 这些现有命令不变。
你可以把它理解成:
- 仓库品牌升级为
google2api-cli - NotebookLM 仍然是当前最成熟、最清晰的主入口
- 对老用户继续兼容
notebooklm-cdp-cli的安装和命令习惯
一句话:这是一个以 NotebookLM 为起点、向更广 Google 工作流延展的 CLI 升级版。
- GitHub 仓库名已经升级为
google2api-cli - Python 包名暂时仍为
notebooklm-cdp-cli - 主命令暂时仍为
notebooklm gemini-web和colab保持现有入口
这样做的目的是先完成品牌整理,不立刻打断已有脚本、文档和用户环境。
如果你之前把它看成“一个只服务 NotebookLM 的 CDP CLI”,现在可以把它更新理解为:
- NotebookLM 是第一主入口
- Gemini / Flow / Colab 已经并入同一命令体系
- 真实浏览器身份复用仍然是整套设计的核心
- 未来仓库命名不再限制在单产品叙事里
它保留 CLI / RPC 的效率, 但把认证思路从 Playwright 的 storage_state.json, 换成 CDP 直连真实 Chrome 登录态。
一句话概括:命令行负责操作,CDP 负责接入,真实浏览器才是认证锚点。
很多自动化方案默认把 Playwright 的登录态文件当成"身份真相"。
临时脚本,可以。 长期工作,不够。
因为一旦你真的把 NotebookLM 当成办公助手来用,问题就会很明显:
- 真实浏览器是一套身份,自动化环境又是一套身份
- 登录态漂移,维护成本上升
- 你真正工作的浏览器里明明已经登录,自动化这边却还在守着一份状态文件
- 最后,NotebookLM 被锁进了终端,而不是融入你的真实工作流
这个项目不是反对 Playwright。 它反对的是另一件事:不该把离线状态文件,当成长期认证模型。
这个项目主要面向这样的用户:
- 你已经在本地 Chrome / Chromium 中长期登录 Google / NotebookLM
- 你希望复用这套真实身份,而不是维护一份自动化专用登录态
- 你希望 NotebookLM 的主要操作仍然走 CLI / RPC
- 你希望自动化能力尽量贴近真实浏览器,而不是依赖重 DOM 流程
如果你想要的是:
- 完全隔离的自动化专用浏览器
- DOM 自动化优先
- 以 Playwright session 为核心设计
那这可能不是你的主路径。
目前 CLI 覆盖的范围包括:
- browser attach / browser status
- auth check 等认证诊断
- notebook、source、chat、notes、share、research
- artifact 列表与管理
- report / audio / video / slide / infographic 的生成与下载流程
- 三个正式产品入口:
notebooklm 负责 NotebookLMgemini-web 负责 Gemini / Flowcolab 负责 Colab
| Product | Command families | Stability |
|---|---|---|
| NotebookLM | browser, auth, doctor, notebook, source, chat / ask, notes, share, research, artifact, generate, download, language |
supported |
| Gemini | gemini-web generate text, gemini-web ask, gemini-web generate image, gemini-web generate vision |
supported |
| Gemini | gemini-web deep-research, gemini-web generate video, gemini-web chat ... |
experimental |
| Flow | gemini-web flow open, gemini-web flow text-to-video, gemini-web flow image-to-video, gemini-web flow screenshot |
experimental |
| Colab | colab notebook list/select/current/open/info/summary, colab cell count/run/run-file, colab runtime status |
supported |
| Colab | colab file upload/list/download, colab artifact list/latest/get/download, colab notebook export |
best-effort |
Stability 语义:
supported表示 CLI contract 和回归测试覆盖稳定输出结构。experimental表示依赖浏览器 UI 或弱选择器,输出会显式带stability: "experimental"。best-effort表示能力存在,但依赖 Colab 页面内 API、DOM 链接、浏览器 fetch 或 DOM 重建;输出会显式带stability: "best_effort"或stability: "best-effort"等价文案时按 JSON 字段为准。
Colab file / artifact / export 的边界:
- 文件上传是浏览器页内 best-effort 提交;大文件传输不承诺稳定。
- 文件和 artifact 下载只支持可从页面上下文
fetch的 HTTP(S) URL;blob:、data:、缺失 URL 会返回结构化 unsupported error。 - Notebook export 是 DOM 重建的 best-effort 导出,不承诺与 Colab 原生导出完全一致。
- JSON 输出会区分 CLI
status和操作状态,例如upload.state、download.state、export.state,并提供evidence/uncertainty。
共享 target 解析层仍保留在整合命令面中,
例如 notebooklm targets ... --product colab,
但它是 secondary route,不是 Colab 的主公开入口。
| 旧入口 | 新入口 |
|---|---|
| 独立 NotebookLM CLI | 保持 notebooklm notebook/source/chat/research/artifact/generate/download ... |
gemini-web-cli generate text |
正式入口:gemini-web generate text;整合入口:notebooklm gemini generate text |
gemini-web-cli ask |
正式入口:gemini-web ask;整合入口:notebooklm gemini ask |
gemini-web-cli generate image/vision/video |
正式入口:gemini-web generate image/vision/video;整合入口:notebooklm gemini generate image/vision/video,其中 video 为 experimental |
gemini-web-cli flow ... |
正式入口:gemini-web flow ...;整合入口:notebooklm flow ...,当前 Flow 命令为 experimental |
colab-cdp-cli notebook list/select/current/open/info/summary |
正式入口:colab notebook ... |
colab-cdp-cli cell/runtime/file/artifact/notebook export |
正式入口:colab cell/runtime/file/artifact/notebook export ... |
旧仓只作为迁移来源;使用本仓不需要安装旧 Gemini/Colab 仓库。
在合并仓里,gemini-web 和 colab 都是正式产品入口,不是兼容补丁命名。
- Linux:supported,当前首发目标
- Windows:experimental / deferred,当前不承诺稳定可用
这不是一句模糊的"跨平台支持中", 而是明确的产品边界:
- Linux 已经足够接近发布形态
- Windows 仍在重构与稳定性治理阶段
- 因此当前不把 Windows 当作首发承诺平台
uv sync
uv run notebooklm --help这条链路已经在全新 Linux VPS 上从 0 验证过一遍:
Xvfb :99
-> 持久 Chrome profile
-> CDP on 127.0.0.1:9222
-> x11vnc + noVNC
-> google2api-cli / notebooklm --host/--port
Chrome 的关键启动方式:
DISPLAY=:99 google-chrome-stable \
--remote-debugging-port=9222 \
--user-data-dir=$HOME/.browser-login/google-chrome-user-data \
--no-sandbox实测建议:
- Linux 是当前稳定主路径
- 主 attach 路径优先
--host 127.0.0.1 --port 9222 - 不要依赖
DevToolsActivePort自动发现 - 登录恢复优先走同 profile 的
noVNC接管
完整 runbook 见 docs/linux-server-runbook.md。
这版仓库直接附带了服务器侧脚本:
scripts/install-base-linux.shscripts/start-chrome-cdp-linux.shscripts/start-novnc-linux.shscripts/verify-linux-host.shscripts/harden-ssh-linux.sh
这些脚本的目标不是替代 CLI,而是把 Linux 服务器上的浏览器身份底座固定下来。
你需要:
- 一个可复用的 Chrome / Chromium profile
- 对应浏览器实例可通过 CDP 连接
1)显式指定 Chrome profile 路径
uv run notebooklm browser attach \
--user-data-dir "/path/to/your/chrome-profile"
uv run notebooklm auth check
uv run notebooklm notebook list2)通过环境变量提供 profile 路径
export NOTEBOOKLM_CDP_USER_DATA_DIR="/path/to/your/chrome-profile"
uv run notebooklm browser attach
uv run notebooklm auth check3)直接连接已知的 CDP host / port
uv run notebooklm --host 127.0.0.1 --port 9222 browser status
uv run notebooklm --host 127.0.0.1 --port 9222 auth checkuv run notebooklm browser attach --user-data-dir "/path/to/your/chrome-profile"
uv run notebooklm auth check
uv run notebooklm notebook list
uv run notebooklm source list --notebook <notebook-id>
uv run notebooklm ask "Summarize the main ideas in Chinese." --notebook <notebook-id>generate report --format 当前支持的值:
briefing_docstudy_guideblog_postcustom
当你使用 --format custom 时,需要同时提供 --prompt。
summary 不是合法的 report format。
如果你要 notebook summary,请使用:
uv run notebooklm notebook summary --notebook <notebook-id>示例:
uv run notebooklm generate report \
--notebook <notebook-id> \
--format briefing_doc \
--json当一次生成请求已经被接受、但 artifact 仍处于 pending 时,CLI 会做一次短暂的 best-effort 检查:
- 如果已经能识别到新 artifact,会尽量直接返回 artifact id
- 如果还不能确定,则保持 pending,并给出后续命令提示
本地 ledger 路径:~/.notebooklm-cdp/pending_submissions.json
常用命令:
uv run notebooklm artifact pending --json
uv run notebooklm artifact resolve-pending <submission-id> --jsonartifact resolve-pending 只有在当前 artifact 列表里存在唯一强候选时才会自动解析;
否则会返回候选项,而不是假装确定。
这个项目不是在重新发明 NotebookLM client。 它做的是一层更贴近真实使用的身份对齐:
- 真实浏览器继续是真实浏览器
- CLI 继续是 CLI
- CDP 把两者接起来
而不是再造一个只属于自动化的平行身份世界。
本项目是一个独立 CLI, 但当前 NotebookLM client / RPC 能力建立在 notebooklm-py 之上。
大致分工如下:
本仓库负责:
- live Chrome identity via CDP
- CLI surface
- 本地状态管理
notebooklm-py 负责:
- NotebookLM client
- RPC types
- 后端调用能力
本项目刻意不把 notebooklm-py 的 Playwright / storage_state.json 登录流
当作主认证模型。
向上游项目致谢。 第三方组件与补充说明见 THIRD_PARTY.md。
MIT. See LICENSE.
google2api-cli is the renamed and broadened evolution of notebooklm-cdp-cli.
The repository name now reflects a wider Google-facing CLI surface, while the current installed package and commands remain compatible with the existing notebooklm, gemini-web, and colab entry points.
In practice, this means:
- the repository brand is now
google2api-cli - NotebookLM is still the clearest and most mature primary entry
- existing command habits do not break immediately
This is best read as a NotebookLM-first upgrade path, not a sudden rewrite of the CLI contract.
- GitHub repository:
google2api-cli - Python package name: still
notebooklm-cdp-clifor now - main command: still
notebooklm gemini-webandcolabremain valid product commands
The goal is to clean up branding first without breaking existing scripts and environments.
It keeps the speed of CLI / RPC workflows,
but moves auth away from Playwright's storage_state.json
and toward a live Chrome identity over CDP.
In one line:
CLI for operations. CDP for attachment. Real Chrome as the auth anchor.
Many automation flows effectively treat Playwright auth state as the source of truth.
That works for scripts. It breaks down for real daily work.
Once NotebookLM becomes part of an actual workflow, the pain becomes obvious:
- your real browser is one identity
- your automation environment is another
- login state drifts
- your browser is already logged in, yet automation still depends on a separate state file
- NotebookLM ends up trapped in a terminal silo instead of living inside your real browser workflow
This project is not anti-Playwright.
Its objection is narrower:
an offline state file should not be treated as the long-term identity model.
This project is for you if:
- you already have a long-lived Google / NotebookLM login in Chrome or Chromium
- you want to reuse that real identity instead of maintaining a separate automation-only auth state
- you want NotebookLM operations to stay primarily CLI / RPC-driven
- you want automation to stay close to your real browser workflow rather than depend on heavy DOM flows
It is probably not your primary path if you want:
- a fully isolated automation-only browser world
- DOM automation first
- a Playwright-session-first design
The CLI currently covers:
- browser attach / browser status
- auth diagnostics such as auth check
- notebook, source, chat, notes, share, research
- artifact listing and management
- generation / download flows for report, audio, video, slide, and infographic
- three primary product commands:
notebooklmfor NotebookLM;gemini-webfor Gemini / Flow;colabfor Colab.
| Product | Command families | Stability |
|---|---|---|
| NotebookLM | browser, auth, doctor, notebook, source, chat / ask, notes, share, research, artifact, generate, download, language |
supported |
| Gemini | gemini-web generate text, gemini-web ask, gemini-web generate image, gemini-web generate vision |
supported |
| Gemini | gemini-web deep-research, gemini-web generate video, gemini-web chat ... |
experimental |
| Flow | gemini-web flow open, gemini-web flow text-to-video, gemini-web flow image-to-video, gemini-web flow screenshot |
experimental |
| Colab | colab notebook list/select/current/open/info/summary, colab cell count/run/run-file, colab runtime status |
supported |
| Colab | colab file upload/list/download, colab artifact list/latest/get/download, colab notebook export |
best-effort |
Stability means:
supportedcommands have stable CLI contracts and regression coverage for their output shape.experimentalcommands depend on browser UI behavior or weak selectors and returnstability: "experimental"in JSON.best-effortcommands exist, but depend on Colab page APIs, DOM links, browser fetch, or DOM reconstruction and returnstability: "best_effort"in JSON.
Colab file / artifact / export boundaries:
- File upload is a best-effort browser-page submission. Large file transfer is not guaranteed.
- File and artifact download only support HTTP(S) URLs fetchable from the page context.
blob:,data:, and missing URLs return structured unsupported errors. - Notebook export is a best-effort DOM reconstruction and is not promised to match Colab's native export exactly.
- JSON output distinguishes CLI
statusfrom operation state, such asupload.state,download.state, andexport.state, and includesevidence/uncertainty.
The shared target-resolution layer remains available through integrated routes such as
notebooklm targets ... --product colab,
but that is a secondary route, not Colab's primary public command surface.
| Old entry point | New entry point |
|---|---|
| Standalone NotebookLM CLI usage | Keep using notebooklm notebook/source/chat/research/artifact/generate/download ... |
gemini-web-cli generate text |
primary entrypoint: gemini-web generate text; integrated entrypoint: notebooklm gemini generate text |
gemini-web-cli ask |
primary entrypoint: gemini-web ask; integrated entrypoint: notebooklm gemini ask |
gemini-web-cli generate image/vision/video |
primary entrypoint: gemini-web generate image/vision/video; integrated entrypoint: notebooklm gemini generate image/vision/video; video is experimental |
gemini-web-cli flow ... |
primary entrypoint: gemini-web flow ...; integrated entrypoint: notebooklm flow ...; current Flow commands are experimental |
colab-cdp-cli notebook list/select/current/open/info/summary |
primary entrypoint: colab notebook ... |
colab-cdp-cli cell/runtime/file/artifact/notebook export |
primary entrypoint: colab cell/runtime/file/artifact/notebook export ... |
The old Gemini and Colab repositories are migration sources only. They are not required dependencies for this package.
Inside the merged repository, both gemini-web and colab are first-class product commands.
- Linux: supported, intended for release use
- Windows: experimental / deferred, not currently promised as stable
This is a deliberate product boundary, not a vague "cross-platform in progress" statement.
uv sync
uv run notebooklm --helpThis repository now includes a validated Linux-first server path:
Xvfb :99
-> persistent Chrome profile
-> CDP on 127.0.0.1:9222
-> x11vnc + noVNC
-> google2api-cli / notebooklm --host/--port
Key Chrome launch pattern:
DISPLAY=:99 google-chrome-stable \
--remote-debugging-port=9222 \
--user-data-dir=$HOME/.browser-login/google-chrome-user-data \
--no-sandboxPractical recommendations:
- Linux is the current stable path
- prefer explicit
--host 127.0.0.1 --port 9222 - do not depend on
DevToolsActivePort - use same-profile noVNC takeover for login recovery
See docs/linux-server-runbook.md for the full runbook.
This release now ships server-side helper scripts:
scripts/install-base-linux.shscripts/start-chrome-cdp-linux.shscripts/start-novnc-linux.shscripts/verify-linux-host.shscripts/harden-ssh-linux.sh
These are meant to stabilize the Linux browser identity layer around the CLI, not replace the CLI itself.
You need:
- a reusable Chrome / Chromium profile
- a browser instance reachable via CDP
1) Attach with an explicit profile path
uv run notebooklm browser attach \
--user-data-dir "/path/to/your/chrome-profile"
uv run notebooklm auth check
uv run notebooklm notebook list2) Provide the profile via environment variable
export NOTEBOOKLM_CDP_USER_DATA_DIR="/path/to/your/chrome-profile"
uv run notebooklm browser attach
uv run notebooklm auth check3) Connect to an existing CDP host / port
uv run notebooklm --host 127.0.0.1 --port 9222 browser status
uv run notebooklm --host 127.0.0.1 --port 9222 auth checkuv run notebooklm browser attach --user-data-dir "/path/to/your/chrome-profile"
uv run notebooklm auth check
uv run notebooklm notebook list
uv run notebooklm source list --notebook <notebook-id>
uv run notebooklm ask "Summarize the main ideas in Chinese." --notebook <notebook-id>Valid values for generate report --format:
briefing_docstudy_guideblog_postcustom
When using --format custom, you must also provide --prompt.
summary is not a valid report format.
If you want the notebook summary, use:
uv run notebooklm notebook summary --notebook <notebook-id>Example:
uv run notebooklm generate report \
--notebook <notebook-id> \
--format briefing_doc \
--jsonWhen a generation request has been accepted but the artifact is still pending, the CLI performs a short best-effort lookup:
- if a newly created artifact can already be identified, it tries to return the artifact id directly
- otherwise it keeps the result as pending and points you to follow-up commands
Local ledger path: ~/.notebooklm-cdp/pending_submissions.json
Useful commands:
uv run notebooklm artifact pending --json
uv run notebooklm artifact resolve-pending <submission-id> --jsonartifact resolve-pending only auto-resolves when there is a single strong candidate.
Otherwise it returns candidates instead of pretending certainty.
This project is not trying to reinvent the NotebookLM client. It focuses on a more realistic identity alignment layer:
- real browser stays real browser
- CLI stays CLI
- CDP connects the two
instead of creating a second automation-only identity world.
This repository is an independent CLI, but its current NotebookLM client / RPC capability builds on top of notebooklm-py.
Roughly speaking:
this repo handles:
- live Chrome identity via CDP
- CLI surface
- local state management
notebooklm-py handles:
- NotebookLM client
- RPC types
- backend capability
This project intentionally does not treat the Playwright / storage_state.json login flow in notebooklm-py as its primary auth model.
With thanks to the upstream project. See THIRD_PARTY.md for third-party notices and additional details.
MIT. See LICENSE.