import puppeteer from 'puppeteer-extra'; import StealthPlugin from 'puppeteer-extra-plugin-stealth'; import { writeFileSync } from 'fs'; puppeteer.use(StealthPlugin()); async function captureAgeGateCookies() { const browser = await puppeteer.launch({ headless: false, // Visible browser so you can complete age gate manually args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-blink-features=AutomationControlled' ] }); const page = await browser.newPage(); await page.setViewport({ width: 1920, height: 1080 }); console.log('\n==========================================='); console.log('INSTRUCTIONS:'); console.log('1. A browser window will open'); console.log('2. Complete the age gate manually'); console.log('3. Wait until you see the store page load'); console.log('4. Press ENTER in this terminal when done'); console.log('===========================================\n'); await page.goto('https://curaleaf.com/stores/curaleaf-az-48th-street'); // Wait for user to complete age gate manually await new Promise((resolve) => { process.stdin.once('data', () => resolve(null)); }); // Get cookies after age gate const cookies = await page.cookies(); console.log('\nCaptured cookies:', JSON.stringify(cookies, null, 2)); // Save cookies to file writeFileSync( '/home/kelly/dutchie-menus/backend/curaleaf-cookies.json', JSON.stringify(cookies, null, 2) ); console.log('\n✅ Cookies saved to curaleaf-cookies.json'); console.log('Current URL:', page.url()); await browser.close(); process.exit(0); } captureAgeGateCookies();