3 Commits

Author SHA1 Message Date
Deheng Huang 189253e0df feat(patchright): temp profile and CDP cross-window detection
Major improvements for adding new Google accounts:

1. Temporary profile for new accounts:
   - Create isolated temp directory with tempfile.mkdtemp()
   - Avoids Chrome profile switching when signing into different account
   - Auto-cleanup after authentication completes

2. CDP-based cross-window detection:
   - Use Chrome DevTools Protocol to detect NotebookLM pages
   - Works even when Chrome opens new windows during login
   - Target.getTargets finds pages across all Chrome windows

3. Multi-tab monitoring:
   - Check all pages in context, not just the first one
   - Handle Google's multi-tab login flow correctly

4. Session capture from other windows:
   - Navigate controlled page to NotebookLM after CDP detection
   - Extract cookies (session shared across windows)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-29 13:47:30 +08:00
Deheng Huang 5cf9eeea91 feat(auth): return email and storage_state from patchright auth
- authenticate_with_patchright now returns (success, email, storage_state)
- Add _extract_email_from_page helper
- Caller responsible for saving credentials

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-28 22:53:49 +08:00
Deheng Huang 6f0d08deae feat(auth): use Patchright for Google authentication
Google blocks personal Gmail sign-in with Playwright's bundled Chromium,
showing "This browser or app may not be secure" error. This commit:

- Add patchright_auth.py module using anti-detection Playwright fork
- Route Google auth through Patchright in auth_manager.py
- Add patchright>=1.50.0 to requirements.txt
- Fall back to agent-browser if Patchright unavailable

Key anti-detection techniques:
- ignore_default_args=["--enable-automation"]
- --disable-blink-features=AutomationControlled
- Uses real Chrome via executable_path
- Persistent context for session management

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-27 10:21:53 +08:00