Documentation
¶
Index ¶
- func BrowserLogin() ([]*http.Cookie, error)
- func BuildCookieHeader(cookies []*http.Cookie) string
- func ClearStorageState() error
- func ExtractChromeCookies() ([]*http.Cookie, error)
- func LoadStorageState() ([]*http.Cookie, error)
- func SaveStorageState(cookies []*http.Cookie) error
- type AuthTokens
- type StorageCookie
- type StorageState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BrowserLogin ¶
BrowserLogin opens a new browser window for the user to log in to Google.
func BuildCookieHeader ¶
BuildCookieHeader creates a Cookie header string like Python does: "SID=xxx; HSID=yyy; ..."
func ClearStorageState ¶
func ClearStorageState() error
ClearStorageState removes the saved auth state.
func ExtractChromeCookies ¶
ExtractChromeCookies reads Google cookies directly from Chrome's SQLite database. Does not launch Chrome, so it does not affect the existing login state. Works even while Chrome is running (read-only).
func LoadStorageState ¶
LoadStorageState loads cookies from a Playwright-format storage_state.json file. It checks NOTEBOOKLM_AUTH_JSON env var first, then falls back to the default path.
func SaveStorageState ¶
SaveStorageState saves cookies in Playwright-compatible format.
Types ¶
type AuthTokens ¶
type AuthTokens struct {
Cookies []*http.Cookie `json:"-"`
CSRFToken string `json:"csrf_token"` // SNlM0e value
SessionID string `json:"session_id"` // FdrFJe value
}
AuthTokens holds all authentication data needed for API calls.
func ExtractTokens ¶
func ExtractTokens(cookies []*http.Cookie) (*AuthTokens, error)
ExtractTokens fetches the NotebookLM page and extracts CSRF token and session ID.
func (*AuthTokens) IsValid ¶
func (a *AuthTokens) IsValid() bool
IsValid checks if the tokens appear to be usable.
type StorageCookie ¶
type StorageState ¶
type StorageState struct {
Cookies []StorageCookie `json:"cookies"`
}
StorageState mirrors Playwright's storage_state.json format.