import { logger } from '../utils/logger.js';
import { BrowserManager } from '../automation/browser.js';

async function main() {
  try {
    logger.info('[WX Video] Launching headful browser...');
    const browser = await BrowserManager.getBrowser({ headless: false });
    const context = await browser.newContext({
      viewport: { width: 1920, height: 1080 },
      locale: 'zh-CN',
      timezoneId: 'Asia/Shanghai',
    });
    const page = await context.newPage();
    const url = 'https://channels.weixin.qq.com/platform';
    logger.info(`[WX Video] Opening page: ${url}`);
    await page.goto(url, { waitUntil: 'domcontentloaded' });
    logger.info('[WX Video] Page opened. You can now operate in the browser window.');
    // 不主动关闭，让你在浏览器里手动操作；进程保持运行
  } catch (e) {
    logger.error('[WX Video] Failed to open page:', e);
    process.exit(1);
  }
}

void main();

