rpc

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Notebook operations
	MethodListNotebooks  = "wXbhsf"
	MethodCreateNotebook = "CCqFvf"
	MethodGetNotebook    = "rLM1Ne"
	MethodRenameNotebook = "s0tc2d"
	MethodDeleteNotebook = "WWINqb"

	// Source operations
	MethodAddSource            = "izAoDd"
	MethodAddSourceFile        = "o4cbdc" // Register uploaded file as source
	MethodDeleteSource         = "tGMBJ"
	MethodGetSource            = "hizoJc"
	MethodRefreshSource        = "FLmJqe"
	MethodCheckSourceFreshness = "yR9Yof"
	MethodUpdateSource         = "b7Wfje"
	MethodDiscoverSources      = "qXyaNe"

	// Summary and query
	MethodSummarize           = "VfAZjd"
	MethodGetSourceGuide      = "tr032e"
	MethodGetSuggestedReports = "ciyUvf"

	// Artifact operations
	MethodCreateArtifact     = "R7cb6c"
	MethodListArtifacts      = "gArtLc"
	MethodDeleteArtifact     = "V5N4be"
	MethodRenameArtifact     = "rc3d8d"
	MethodExportArtifact     = "Krh3pd"
	MethodShareArtifact      = "RGP97b"
	MethodGetInteractiveHTML = "v9rmvd"
	MethodReviseSlide        = "KmcKPe"

	// Research
	MethodStartFastResearch = "Ljjv0c"
	MethodStartDeepResearch = "QA9ei"
	MethodPollResearch      = "e3bVqc"
	MethodImportResearch    = "LBwxtb"

	// Note and mind map operations
	MethodGenerateMindMap     = "yyryJe"
	MethodCreateNote          = "CYK0Xb"
	MethodGetNotesAndMindMaps = "cFji9"
	MethodUpdateNote          = "cYAfTb"
	MethodDeleteNote          = "AH0mwd"

	// Conversation
	MethodGetLastConversationID = "hPTbtc"
	MethodGetConversationTurns  = "khqZz"

	// Sharing operations
	MethodShareNotebook  = "QDyure"
	MethodGetShareStatus = "JFMDGd"

	// Additional operations
	MethodRemoveRecentlyViewed = "fejl7e"
	MethodGetUserSettings      = "ZwVcOc"
	MethodSetUserSettings      = "hT54vc"
)
View Source
const (
	BatchExecuteURL = "https://notebooklm.google.com/_/LabsTailwindUi/data/batchexecute"
	QueryURL        = "" /* 156-byte string literal not displayed */
	UploadURL       = "https://notebooklm.google.com/upload/_/"
)

API endpoint URLs

Variables

This section is empty.

Functions

func BuildBatchURL

func BuildBatchURL(rpcID, sourcePath, sessionID string) string

BuildBatchURL constructs the full URL for a batchexecute call.

func BuildChatURL

func BuildChatURL(sessionID string, reqID int) string

BuildChatURL constructs the URL for chat/query endpoint.

func DecodeBatchResponse

func DecodeBatchResponse(body string, targetRPCID string) (json.RawMessage, error)

DecodeBatchResponse parses the batchexecute response format. Format:

)]}'        <- anti-XSSI prefix (remove)
<byte_count>
<json_payload>
... (repeated chunks)

Each payload is a JSON array. We look for wrb.fr entries matching the target RPC ID. null result_data is valid (empty list, void operation success).

func EncodeBatchRequest

func EncodeBatchRequest(rpcID string, params any, csrfToken string) (string, error)

EncodeBatchRequest builds the form-encoded body for a batchexecute call. Format: f.req=[[[rpc_id, json_params, null, "generic"]]]&at=csrf_token&

func IsAuthError

func IsAuthError(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func IsRateLimit

func IsRateLimit(err error) bool

func ParseResultArray

func ParseResultArray(raw json.RawMessage) ([]any, error)

ParseResultArray parses the result JSON into a generic nested array.

func SafeArray

func SafeArray(data []any, indices ...int) []any

SafeArray extracts a sub-array from a nested array at the given indices.

func SafeFloat

func SafeFloat(data []any, indices ...int) float64

SafeFloat extracts a float64 from a nested array at the given indices.

func SafeString

func SafeString(data []any, indices ...int) string

SafeString extracts a string from a nested array at the given indices.

Types

type ArtifactStatusCode

type ArtifactStatusCode int

ArtifactStatusCode represents artifact processing status.

const (
	ArtifactStatusProcessing ArtifactStatusCode = 1
	ArtifactStatusPending    ArtifactStatusCode = 2
	ArtifactStatusCompleted  ArtifactStatusCode = 3
	ArtifactStatusFailed     ArtifactStatusCode = 4
)

func (ArtifactStatusCode) String

func (s ArtifactStatusCode) String() string

type ArtifactTypeCode

type ArtifactTypeCode int

ArtifactTypeCode represents artifact type codes used in RPC calls.

const (
	ArtifactCodeAudio       ArtifactTypeCode = 1
	ArtifactCodeReport      ArtifactTypeCode = 2
	ArtifactCodeVideo       ArtifactTypeCode = 3
	ArtifactCodeQuiz        ArtifactTypeCode = 4
	ArtifactCodeMindMap     ArtifactTypeCode = 5
	ArtifactCodeInfographic ArtifactTypeCode = 7
	ArtifactCodeSlideDeck   ArtifactTypeCode = 8
	ArtifactCodeDataTable   ArtifactTypeCode = 9
)

type CallResult

type CallResult struct {
	Raw    json.RawMessage
	Parsed []any
}

CallResult holds the parsed result of an RPC call.

type Caller

type Caller struct {
	HTTPClient *http.Client
	Cookies    []*http.Cookie
	CSRFToken  string
	SessionID  string
	// contains filtered or unexported fields
}

Caller handles RPC calls to the NotebookLM batchexecute API.

func NewCaller

func NewCaller(cookies []*http.Cookie, csrfToken, sessionID string) *Caller

NewCaller creates a new RPC caller.

func (*Caller) Call

func (c *Caller) Call(rpcID string, params any, notebookPath string) (*CallResult, error)

Call executes a single batchexecute RPC call. Returns (nil, nil) for void operations where Google returns null result_data.

type Error

type Error struct {
	Code    ErrorCode
	Message string
	Method  string
}

func (*Error) Error

func (e *Error) Error() string

type ErrorCode

type ErrorCode int
const (
	ErrUnknown     ErrorCode = 0
	ErrAuth        ErrorCode = 401
	ErrForbidden   ErrorCode = 403
	ErrNotFound    ErrorCode = 404
	ErrRateLimit   ErrorCode = 429
	ErrServer      ErrorCode = 500
	ErrUnavailable ErrorCode = 503
)

type SourceStatusCode

type SourceStatusCode int

SourceStatusCode represents source processing status.

const (
	SourceStatusProcessing SourceStatusCode = 1
	SourceStatusReady      SourceStatusCode = 2
	SourceStatusError      SourceStatusCode = 3
	SourceStatusPreparing  SourceStatusCode = 5
)

func (SourceStatusCode) String

func (s SourceStatusCode) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL