← back to Ventura Corridor
scripts/debug-social-bb.cjs
50 lines
'use strict';
require('dotenv').config({ path: require('os').homedir() + '/Projects/secrets-manager/.env' });
const Browserbase = require('/Users/macstudio3/Projects/ventura-corridor/node_modules/@browserbasehq/sdk').default;
const { chromium } = require('/Users/macstudio3/Projects/ventura-corridor/node_modules/playwright-core');
const PROJECT_ID = process.env.BROWSERBASE_PROJECT_ID;
const API_KEY = process.env.BROWSERBASE_API_KEY;
function sleep(ms) { return new Promise(r => setTimeout(r, ms)); }
async function main() {
const bb = new Browserbase({ apiKey: API_KEY });
const session = await bb.sessions.create({ projectId: PROJECT_ID });
console.log('Session:', session.id);
const browser = await chromium.connectOverCDP(session.connectUrl);
const ctx = browser.contexts()[0];
const page = ctx.pages()[0];
// Go to Google and search
await page.goto('https://www.google.com', { waitUntil: 'domcontentloaded', timeout: 15000 });
await sleep(2000);
// Search for Roadside Taco Instagram
await page.goto('https://www.google.com/search?q=site:instagram.com+"roadside+taco"+ventura',
{ waitUntil: 'domcontentloaded', timeout: 15000 });
await sleep(3000);
const content = await page.content();
console.log('\n--- PAGE CONTENT (first 3000 chars) ---');
console.log(content.substring(0, 3000));
// Extract all links with instagram
const links = content.match(/https?:\/\/[^\s"'<>]+instagram[^\s"'<>]+/g) || [];
console.log('\n--- Instagram links found ---');
links.slice(0, 10).forEach(l => console.log(' ' + l.substring(0, 100)));
// Also check what the URL actually is (might have been redirected)
const url = page.url();
console.log('\nFinal URL:', url);
// Take a screenshot for visual inspection
await page.screenshot({ path: '/Users/macstudio3/Projects/_ventura-recon/debug-google.png' });
console.log('Screenshot saved to debug-google.png');
await browser.close();
}
main().catch(e => { console.error(e); process.exit(1); });