notebooklm-mcp-server 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.js +40 -14
- package/dist/index.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/dist/auth.js
CHANGED
|
@@ -25,22 +25,48 @@ export class AuthManager {
|
|
|
25
25
|
let isDone = false;
|
|
26
26
|
try {
|
|
27
27
|
await Promise.race([
|
|
28
|
-
// Wait for redirect to
|
|
29
|
-
page.waitForURL(
|
|
30
|
-
|
|
31
|
-
//
|
|
32
|
-
page.waitForSelector('
|
|
28
|
+
// Wait for redirect to a specific notebook (the most common landing after login)
|
|
29
|
+
page.waitForURL('**/notebook/**', { timeout: 300000 }).then(() => { isDone = true; }),
|
|
30
|
+
// Wait for visual elements that only appear when logged in
|
|
31
|
+
// 1. The "Create new" button or notebook grid
|
|
32
|
+
page.waitForSelector('div[role="main"], .notebook-grid, button:has-text("Create new"), button:has-text("Crear nuevo")', { timeout: 300000 })
|
|
33
33
|
.then(() => { isDone = true; }),
|
|
34
|
-
//
|
|
35
|
-
page.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
// 2. The account button (usually an img or button with aria-label)
|
|
35
|
+
page.waitForSelector('button[aria-label*="Account"], button[aria-label*="Cuenta"], img[src*="googleusercontent.com"]', { timeout: 300000 })
|
|
36
|
+
.then(() => { isDone = true; }),
|
|
37
|
+
// 3. Fallback: check if we have the critical session cookies
|
|
38
|
+
new Promise((resolve) => {
|
|
39
|
+
const checkLoop = async () => {
|
|
40
|
+
if (isDone)
|
|
41
|
+
return;
|
|
42
|
+
try {
|
|
43
|
+
const cookies = await context.cookies();
|
|
44
|
+
const hasSession = cookies.some(c => c.name === '__Secure-3PSID' || c.name === 'SID');
|
|
45
|
+
if (hasSession && page.url().includes('notebooklm.google.com')) {
|
|
46
|
+
isDone = true;
|
|
47
|
+
resolve(true);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
setTimeout(checkLoop, 2000);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
isDone = true;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
checkLoop();
|
|
58
|
+
})
|
|
41
59
|
]);
|
|
42
|
-
//
|
|
43
|
-
await
|
|
60
|
+
// Ensure we actually have cookies before proceeding
|
|
61
|
+
const finalCookies = await context.cookies();
|
|
62
|
+
const hasSid = finalCookies.some(c => c.name === '__Secure-3PSID' || c.name === 'SID');
|
|
63
|
+
if (!hasSid) {
|
|
64
|
+
// If we don't have session cookies, we might have just landed on the landing page
|
|
65
|
+
// Wait a bit more or throw to avoid saving empty/expired sessions
|
|
66
|
+
if (onStatus)
|
|
67
|
+
onStatus('Verifying session session...');
|
|
68
|
+
await page.waitForTimeout(3000);
|
|
69
|
+
}
|
|
44
70
|
}
|
|
45
71
|
catch (e) {
|
|
46
72
|
throw new Error('Authentication timed out or browser was closed.');
|
package/dist/index.js
CHANGED
package/dist/server.js
CHANGED