import sys
from playwright.sync_api import sync_playwright

sys.stdout.reconfigure(encoding="utf-8")
user_data = r"C:\Users\Admin\.chrome_muse_phu2234"

try:
    with sync_playwright() as p:
        context = p.chromium.launch_persistent_context(
            user_data_dir=user_data,
            channel="chrome",
            headless=True,
        )
        cookies = context.cookies("https://muse.ai")
        print(f"Loaded {len(cookies)} cookies for https://muse.ai:")
        for c in cookies:
            print(f"  • {c['name']} = {c['value'][:20]}... (domain: {c['domain']})")
        context.close()
except Exception as e:
    import traceback
    traceback.print_exc()
