Initial commit 🚀

This commit is contained in:
Felix Klement committed 2026-10-09 14:00:40 +02:00
commit fd58a8d32f
235 files changed
+19775

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
import { chromium } from 'playwright';
const [,, url, prefix, width = '1440', height = '900', max = '12'] = process.argv;
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: Number(width), height: Number(height) } });
await page.goto(url, { waitUntil: 'networkidle', timeout: 60000 });
// trigger lazy loading by scrolling through
const total = await page.evaluate(() => document.documentElement.scrollHeight);
for (let y = 0; y < total; y += 600) { await page.evaluate((y) => window.scrollTo(0, y), y); await page.waitForTimeout(150); }
await page.evaluate(() => window.scrollTo(0, 0));
await page.waitForTimeout(800);
const h = Number(height);
const n = Math.min(Number(max), Math.ceil(total / h));
for (let i = 0; i < n; i++) {
await page.evaluate((y) => window.scrollTo(0, y), i * h);
await page.waitForTimeout(700);
await page.screenshot({ path: `${prefix}-${String(i).padStart(2, '0')}.png`, fullPage: false });
}
console.log('total height', total, 'shots', n);
await browser.close();