notebooklm
VerifiedInstall, authenticate, troubleshoot, and operate Gemini Notebook through the notebooklm-py CLI or typed async Python API. Use for notebook and source management, grounded chat and research, and artifact generation or download when the user mentions Gemini Notebook, notebooklm-py, the notebooklm CLI, or its Python API. Do not use for the generic Gemini API or unrelated content creation.
scripts/_live_auth_scenarios/crash_safe_writer.py
View on GitHub"""Hammer the canonical storage writer so the parent can kill it mid-write.
Unlike the other cells this one prints nothing and is *expected* to be killed:
``Matrix.phase_crash_safety`` starts it, sleeps briefly, sends ``SIGKILL``, and
then re-reads the target file. The file must always parse and must still hold
the required Google session cookies, proving ``replace_from_login`` never leaves
a torn canonical write behind.
Usage: ``python -m scripts._live_auth_scenarios.crash_safe_writer <target> <source>``
"""
from __future__ import annotations
import json
import sys
from pathlib import Path
from notebooklm._auth.storage import replace_from_login
from ._contract import require
#: Number of back-to-back canonical writes attempted before exiting normally.
WRITE_ITERATIONS = 10000
def main(argv: list[str] | None = None) -> None:
"""Rewrite ``argv[0]`` from the storage state in ``argv[1]``, repeatedly."""
args = sys.argv[1:] if argv is None else argv
# Name the argv contract. This cell is the only one taking arguments, and
# it is *expected* to die by SIGKILL, so a bare IndexError from a wrong
# invocation would be easy to mistake for the kill the parent just sent.
require(len(args) >= 2, "crash_safe_writer needs <target> <source>")
target = Path(args[0])
# Explicit UTF-8, matching both sides of ``phase_crash_safety``. A
# locale-dependent read is worse here than anywhere else in the package:
# under a non-UTF-8 locale it raises before the first write, the parent
# then kills an already-dead child and re-reads its own pristine copy,
# which parses fine — so the cell reports PASS having never exercised the
# canonical writer at all.
state = json.loads(Path(args[1]).read_text(encoding="utf-8"))
for _ in range(WRITE_ITERATIONS):
replace_from_login(target, state, include_domains=None)
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |