Elffuss BraidHub

utopia-ia/elffuss-code public

2df00d521f0c · 870 BRawPermalink
1import { chromium } from 'playwright';
2const BASE = process.env.BASE || 'https://code.elffuss.com';
3const b = await chromium.launch({ args: ['--autoplay-policy=no-user-gesture-required'] });
4const ctx = await b.newContext();
5await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} });
6const p = await ctx.newPage();
7const hits = [];
8p.on('response', r => {
9 const u = r.url();
10 if (/sndcdn|soundcloud/i.test(u) && /\.(mp3|m4a|ts|aac)|media\/|stream/i.test(u)) hits.push({ url: u, type: r.headers()['content-type'], status: r.status() });
11});
12await p.goto(BASE + '/?test-opfs', { waitUntil: 'domcontentloaded' });
13await p.waitForTimeout(1500);
14await p.click('#activity img');
15console.log('esperando audio…');
16await p.waitForTimeout(8000);
17console.log('hits:', JSON.stringify(hits.slice(0, 15), null, 2));
18await b.close();