import { chromium } from "playwright"; async function crawl(url: string) { const browser = await chromium.launch({ headless: true, args: ["--no-sandbox", "--disable-dev-shm-usage"], }); const page = await browser.newPage(); await page.goto(url, { waitUntil: "networkidle", timeout: 20000 }); const title = await page.title(); const text = (await page.textContent("body"))?.slice(0, 2000) || ""; await browser.close(); return { url, title, text }; } (async () => { console.log(JSON.stringify(await crawl("https://example.com"), null, 2)); })();