Skip to content

Commit 3a40a67

Browse files
authored
Merge pull request teng-lin#151 from teng-lin/fix/regional-login-cookies
fix(auth): force .google.com cookies during login for regional users
2 parents 26df2c1 + ed87c87 commit 3a40a67

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/notebooklm/cli/session.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343

4444
logger = logging.getLogger(__name__)
4545

46+
GOOGLE_ACCOUNTS_URL = "https://accounts.google.com/"
47+
NOTEBOOKLM_URL = "https://notebooklm.google.com/"
48+
NOTEBOOKLM_HOST = "notebooklm.google.com"
49+
4650

4751
def _sync_server_language_to_config() -> None:
4852
"""Fetch server language setting and persist to local config.
@@ -212,7 +216,7 @@ def login(storage):
212216
)
213217

214218
page = context.pages[0] if context.pages else context.new_page()
215-
page.goto("https://notebooklm.google.com/")
219+
page.goto(NOTEBOOKLM_URL)
216220

217221
console.print("\n[bold green]Instructions:[/bold green]")
218222
console.print("1. Complete the Google login in the browser window")
@@ -221,8 +225,13 @@ def login(storage):
221225

222226
input("[Press ENTER when logged in] ")
223227

228+
# Force .google.com cookies for regional users (e.g. UK lands on
229+
# .google.co.uk). Use "load" not "networkidle" to avoid analytics hangs.
230+
page.goto(GOOGLE_ACCOUNTS_URL, wait_until="load")
231+
page.goto(NOTEBOOKLM_URL, wait_until="load")
232+
224233
current_url = page.url
225-
if "notebooklm.google.com" not in current_url:
234+
if NOTEBOOKLM_HOST not in current_url:
226235
console.print(f"[yellow]Warning: Current URL is {current_url}[/yellow]")
227236
if not click.confirm("Save authentication anyway?"):
228237
context.close()

0 commit comments

Comments
 (0)