2026-10-02 13:36:32 -04:00
const { chromium } = require ( 'playwright' ) ;
2026-10-06 10:09:45 -04:00
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 ;
2026-10-02 13:36:32 -04:00
( 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 ( ) ; } ) ( ) ;