- Add backend stale process monitoring API (/api/stale-processes) - Add users management route - Add frontend landing page and stale process monitor UI on /scraper-tools - Move old development scripts to backend/archive/ - Update frontend build with new features 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
83 lines
2.6 KiB
TypeScript
83 lines
2.6 KiB
TypeScript
import { chromium } from 'playwright';
|
|
import { bypassAgeGatePlaywright } from './src/utils/age-gate-playwright';
|
|
|
|
async function findProducts() {
|
|
const browser = await chromium.launch({ headless: true });
|
|
const context = await browser.newContext({
|
|
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
|
|
viewport: { width: 1280, height: 720 }
|
|
});
|
|
|
|
const page = await context.newPage();
|
|
|
|
try {
|
|
console.log('Loading and bypassing age gate...\n');
|
|
await page.goto('https://curaleaf.com/stores/curaleaf-dispensary-48th-street');
|
|
await page.waitForTimeout(2000);
|
|
await bypassAgeGatePlaywright(page, 'Arizona');
|
|
await page.waitForTimeout(5000);
|
|
|
|
console.log('Scrolling page...\n');
|
|
await page.evaluate(async () => {
|
|
for (let i = 0; i < 3; i++) {
|
|
window.scrollBy(0, 1000);
|
|
await new Promise(r => setTimeout(r, 500));
|
|
}
|
|
});
|
|
await page.waitForTimeout(2000);
|
|
|
|
// Try various product selectors
|
|
const selectors = [
|
|
'[data-testid^="product"]',
|
|
'.product',
|
|
'[class*="Product"]',
|
|
'[class*="product"]',
|
|
'article',
|
|
'[role="article"]',
|
|
'.card',
|
|
'[class*="Card"]',
|
|
'[class*="item"]',
|
|
'[class*="Item"]'
|
|
];
|
|
|
|
console.log('Trying different product selectors:\n');
|
|
|
|
for (const selector of selectors) {
|
|
const count = await page.locator(selector).count();
|
|
if (count > 0) {
|
|
console.log(`✅ ${selector}: ${count} elements found`);
|
|
|
|
// Get first few elements
|
|
const elements = await page.locator(selector).all();
|
|
for (let i = 0; i < Math.min(3, elements.length); i++) {
|
|
const text = await elements[i].textContent();
|
|
const classes = await elements[i].getAttribute('class');
|
|
console.log(` ${i + 1}. Classes: ${classes}`);
|
|
console.log(` Text (first 100 chars): ${text?.trim().substring(0, 100)}`);
|
|
}
|
|
console.log('');
|
|
}
|
|
}
|
|
|
|
// Check for buttons/links that might load products
|
|
const menuButtons = await page.locator('button:has-text("menu"), button:has-text("shop"), a:has-text("View Menu")').count();
|
|
console.log(`\nMenu/Shop buttons: ${menuButtons}`);
|
|
|
|
if (menuButtons > 0) {
|
|
const buttons = await page.locator('button:has-text("menu"), button:has-text("shop"), a:has-text("View Menu")').all();
|
|
console.log('Menu buttons found:');
|
|
for (const btn of buttons.slice(0, 3)) {
|
|
const text = await btn.textContent();
|
|
console.log(` - ${text?.trim()}`);
|
|
}
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
} finally {
|
|
await browser.close();
|
|
}
|
|
}
|
|
|
|
findProducts();
|