import { chromium } from "/home/user/Projects/yt-dlp-transcript-browser/node_modules/.pnpm/@playwright+test@1.59.1/node_modules/@playwright/test/index.mjs"; const site = process.argv[2] ?? "https://jeralyzer.pages.dev"; const SHARD = /\/transcripts\/[^/]+\/page-\d+\.json$/; const browser = await chromium.launch(); const page = await browser.newPage(); page.setDefaultTimeout(60_000); let shards = 0; page.on("request", (r) => { if (SHARD.test(new URL(r.url()).pathname)) shards += 1; }); await page.goto(site + "/", { waitUntil: "domcontentloaded" }); await page.evaluate(() => window.localStorage.setItem("ytdlp-tb:export-filters", JSON.stringify({ v: 1, working: { channels: { included: [], excluded: [] }, nol: true, query: JSON.stringify({ k: "g", o: "AND", c: [{ k: "l", q: "lawsuit", s: "transcripts" }] }) }, profiles: {}, activeProfileName: null }))); shards = 0; await page.reload({ waitUntil: "domcontentloaded" }); const input = page.locator('input[data-testid^="leaf-query-"]').first(); await input.waitFor(); await page.waitForTimeout(3_000); const restored = await input.inputValue(); const onLoad = shards; const fetched = page.waitForRequest((r) => SHARD.test(new URL(r.url()).pathname), { timeout: 30_000 }).then(() => true).catch(() => false); await input.press("Enter"); const afterEnter = await fetched; console.log(`${site}: restored="${restored}" shards-on-load=${onLoad} shard-after-enter=${afterEnter}`); await browser.close();