media-command-guide/explore-playout.js

15 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

const { chromium } = require('playwright');
if (!process.env.DF_SESSION_COOKIE) { console.error('DF_SESSION_COOKIE env var not set — grab the dragonflight.sid cookie value from your browser devtools, export it, rerun.'); process.exit(1); }
const COOKIE=process.env.DF_SESSION_COOKIE;
(async()=>{
const b=await chromium.launch({args:['--no-sandbox','--autoplay-policy=no-user-gesture-required']});
const c=await b.newContext({viewport:{width:1920,height:1080}});
await c.addCookies([{name:'dragonflight.sid',value:COOKIE,domain:'mediacmdr.com',path:'/',httpOnly:true,secure:true}]);
const p=await c.newPage();
await p.goto('https://mediacmdr.com/#playout',{waitUntil:'networkidle'});await p.waitForTimeout(6000);
console.log('URL',p.url());
console.log(await p.evaluate(()=>document.querySelector('main,#app,body').innerText.replace(/\n+/g,' | ').slice(0,3000)));
console.log('BUTTONS',await p.evaluate(()=>[...document.querySelectorAll('button,a[href^="#"]')].filter(e=>e.offsetParent).map(e=>(e.innerText.trim()||e.title||e.getAttribute('href')).slice(0,30)).join(' ; ')));
await p.screenshot({path:'/home/zgaetano/.hermes/cache/scratch/po1.png'});
await b.close();})();