diff --git a/src/viewer/index.js b/src/viewer/index.js index 6ff493f..3b2b4ae 100644 --- a/src/viewer/index.js +++ b/src/viewer/index.js @@ -323,13 +323,21 @@ function filterValidTabs(tabs) { /** * Probe all frames in a tab for HLS manifests. + * Runs in the MAIN world so strategies that depend on page globals work: + * - window.__goon_plugin_data.manifests (set by main-world interceptors) + * - window.Hls / Hls.cast (page's hls.js global) + * - player globals (PHPlayer, flowplayer, etc.) + * - config globals (__NEXT_DATA__, appData, etc.) + * + * The default isolated world cannot see these — only DOM properties like + * video._goon_hls_manifest cross the boundary. * @param {number} tabId * @returns {Promise} array of { url, player } or empty on error */ async function probeHlsManifests(tabId) { try { const results = await chrome.scripting.executeScript({ - target: { tabId, allFrames: true }, + target: { tabId, allFrames: true, world: 'MAIN' }, func: m3u8DeepProbeFn, }); return results.flatMap(r => r.result || []); @@ -384,6 +392,13 @@ async function queryContentScript(tabId) { * Scrape video elements from ALL frames in a tab. * On sites like Pornhub, the video player lives inside an iframe — main-frame-only * scraping sees zero