const { chromium } = require('playwright');
(async () => {
  const b = await chromium.launch({ args: ['--ignore-certificate-errors'] });
  const p = await b.newPage({ viewport: { width: 1200, height: 1600 }, ignoreHTTPSErrors: true, deviceScaleFactor: 2 });
  await p.goto('https://farmer.taild3aaf6.ts.net/fea/category/tablon-de-anuncios/', { waitUntil: 'networkidle' });
  const m = await p.evaluate(() => {
    const arts = document.querySelectorAll('article, .fea-card, .wp-block-post');
    const titles = [...document.querySelectorAll('h2 a, h3 a, .entry-title a, article a')].map(a=>a.textContent.trim()).filter(Boolean).slice(0,30);
    return { articleNodes: arts.length, sampleTitles: titles.slice(0,12) };
  });
  console.log(JSON.stringify(m,null,2));
  await p.screenshot({ path: '/tmp/tablon.png', fullPage: false });
  await b.close();
})();
