(function(){console.log("ThisVid Downloader inject script loaded");const t={flashvars:null,hlsUrls:new Set};function r(){if(window.flashvars){t.flashvars=window.flashvars;return}for(const s in window)if(s.startsWith("flashvars_")&&window[s]){t.flashvars=window[s];break}}function e(s){!s||typeof s!="string"||s.includes(".m3u8")&&t.hlsUrls.add(s)}function l(){if(!t.flashvars)return;[t.flashvars.video_url,t.flashvars.video_alt_url,t.flashvars.video_alt_url2].forEach(e)}function i(){r(),l();const s={flashvars:t.flashvars,hlsUrls:Array.from(t.hlsUrls)};console.log("Sending page data to content script:",s),window.postMessage({type:"THISVID_PAGE_DATA",data:s},"*")}i(),window.addEventListener("message",function(s){s.data&&(s.data.type==="REQUEST_THISVID_DATA"||s.data.type==="REQUEST_PORNHUB_DATA")&&i()});const f=window.XMLHttpRequest;window.XMLHttpRequest=function(){const s=new f,o=s.open;return s.open=function(a,n,...d){return n&&typeof n=="string"&&n.includes(".m3u8")&&(e(n),setTimeout(i,100)),o.apply(this,[a,n,...d])},s};const c=window.fetch;window.fetch=function(...s){const o=s[0],a=typeof o=="string"?o:o?.url,n=c.apply(this,s);return a&&typeof a=="string"&&a.includes(".m3u8")&&(e(a),setTimeout(i,100)),n}})();
