Skip to content

Commit 4e9937c

Browse files
committed
fix: add source-path to all notebook-scoped RPC calls
The NotebookLM BatchExecute API requires a source-path query parameter (/notebook/{id}) for all notebook-scoped operations. Without it, the API returns null for research, artifacts, summary, etc. Fixed: addSource, startResearch, pollResearch, importResearchSources, generateInfographic, generateReport, listArtifacts, getSummary Also adds debug logging to rpcCall and pollResearch for live API debugging.
1 parent 11448a9 commit 4e9937c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/services/notebooklm/client.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export class NotebookLMClient {
288288
];
289289
}
290290

291-
const result = await this.rpcCall(RPCMethod.ADD_SOURCE, params);
291+
const result = await this.rpcCall(RPCMethod.ADD_SOURCE, params, `/notebook/${notebookId}`);
292292

293293
// Extract source ID from response
294294
const resultArr = result as unknown[];
@@ -341,7 +341,7 @@ export class NotebookLMClient {
341341
params = [[query, 1], null, 1, notebookId];
342342
}
343343

344-
const result = await this.rpcCall(methodId, params);
344+
const result = await this.rpcCall(methodId, params, `/notebook/${notebookId}`);
345345
console.log(`[NotebookLM] startResearch raw result:`, JSON.stringify(result));
346346
const resultArr = result as unknown[];
347347

@@ -378,7 +378,7 @@ export class NotebookLMClient {
378378
const result = await this.rpcCall(
379379
RPCMethod.POLL_RESEARCH,
380380
[null, null, notebookId],
381-
undefined,
381+
`/notebook/${notebookId}`,
382382
EXTENDED_FETCH_TIMEOUT_MS
383383
);
384384

@@ -512,7 +512,7 @@ export class NotebookLMClient {
512512
taskId,
513513
notebookId,
514514
sourceArray,
515-
]);
515+
], `/notebook/${notebookId}`);
516516

517517
console.log('[NotebookLM] Research sources imported');
518518
}
@@ -569,7 +569,7 @@ export class NotebookLMClient {
569569
];
570570

571571
try {
572-
const result = await this.rpcCall(RPCMethod.CREATE_ARTIFACT, params);
572+
const result = await this.rpcCall(RPCMethod.CREATE_ARTIFACT, params, `/notebook/${notebookId}`);
573573
return this.parseGenerationResult(result);
574574
} catch (error: unknown) {
575575
console.error(
@@ -626,7 +626,7 @@ export class NotebookLMClient {
626626
];
627627

628628
try {
629-
const result = await this.rpcCall(RPCMethod.CREATE_ARTIFACT, params);
629+
const result = await this.rpcCall(RPCMethod.CREATE_ARTIFACT, params, `/notebook/${notebookId}`);
630630
return this.parseGenerationResult(result);
631631
} catch (error: unknown) {
632632
console.error(
@@ -675,7 +675,7 @@ export class NotebookLMClient {
675675
[2],
676676
notebookId,
677677
'NOT artifact.status = "ARTIFACT_STATUS_SUGGESTED"',
678-
]);
678+
], `/notebook/${notebookId}`);
679679

680680
const resultArr = result as unknown[];
681681
if (!Array.isArray(resultArr) || !Array.isArray(resultArr[0])) {
@@ -725,7 +725,7 @@ export class NotebookLMClient {
725725
const result = await this.rpcCall(RPCMethod.SUMMARIZE, [
726726
notebookId,
727727
[2],
728-
]);
728+
], `/notebook/${notebookId}`);
729729

730730
const resultArr = result as unknown[];
731731
if (!Array.isArray(resultArr)) {

0 commit comments

Comments
 (0)