Created
April 25, 2025 00:41
-
-
Save VictorXLR/8acb5cae59d61544cd122e215fe78ba2 to your computer and use it in GitHub Desktop.
media_meta.bookmark.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:(function(){function f(t){const p=[/https?:\/\/[^"%27\s)]*\.m3u8[^"%27\s)]*/gi,/https?:\/\/[^"%27\s)]*\.mpd[^"%27\s)]*/gi,/https?:\/\/[^"%27\s)]*\.(mp4|webm)[^"%27\s)]*/gi,/https?:\/\/[^"%27\s)]*\/manifest[^"%27\s)]*/gi,/streamUrl["%27\s:=]+[%27"](https?:\/\/[^"%27]+)[%27"]/gi,/videoUrl["%27\s:=]+[%27"](https?:\/\/[^"%27]+)[%27"]/gi,/source["%27\s:=]+[%27"](https?:\/\/[^"%27]+\.(mp4|webm|m3u8|mpd))[%27"]/gi];let m=[];p.forEach(r=>{const o=t.match(r);if(o)m=m.concat(o)});m=m.map(u=>u.replace(/["%27\s)]+$/,%27%27));return[...new Set(m)]}const v=Array.from(document.querySelectorAll(%27video%27));let s=[];if(v.length>0){v.forEach((vid,i)=>{if(vid.src){s.push({name:`Video ${i+1} direct`,url:vid.src})}Array.from(vid.querySelectorAll(%27source%27)).forEach((src,j)=>{if(src.src){s.push({name:`Video ${i+1} source ${j+1}`,url:src.src})}})})}const i=Array.from(document.querySelectorAll(%27iframe%27));if(i.length>0){i.forEach((frm,i)=>{if(frm.src){s.push({name:`Iframe ${i+1}`,url:frm.src,isFrame:true})}})}let ps=document.documentElement.innerHTML;const su=f(ps);su.forEach((u,i)=>{s.push({name:`Stream ${i+1}`,url:u})});const sc=Array.from(document.querySelectorAll(%27script%27));sc.forEach(scr=>{if(scr.textContent&&(scr.textContent.includes(%27player%27)||scr.textContent.includes(%27video%27)||scr.textContent.includes(%27stream%27))){const m=f(scr.textContent);m.forEach((u,i)=>{s.push({name:`Script ${i+1}`,url:u})})}});if(window.performance&&window.performance.getEntries){const r=window.performance.getEntries();const mr=r.filter(rs=>{const u=rs.name||%27%27;return(u.includes(%27.mp4%27)||u.includes(%27.m3u8%27)||u.includes(%27.mpd%27)||u.includes(%27stream%27)||u.includes(%27video%27)||u.includes(%27content%27))});mr.forEach((rs,i)=>{s.push({name:`Network ${i+1}`,url:rs.name})})}s=s.filter((src,idx,self)=>idx===self.findIndex(s=>s.url===src.url));if(s.length===0){alert(%27No video sources found%27);return}const w=window.open(%27%27,%27_blank%27);w.document.write(`<html><head><title>Video Sources</title><style>body{font-family:sans-serif;margin:15px}div{margin:10px 0;padding:8px;background:#f5f5f5;border-radius:4px}button{margin:5px;cursor:pointer}</style></head><body><h3>Found ${s.length} video sources:</h3>${s.map((src,i)=>%60<div><b>${src.name}</b><div style="word-break:break-all;margin:5px 0">${src.url}</div><button onclick="window.open('${src.url}','_blank')">Open</button>${!src.isFrame?%60<button onclick="try{const v=document.createElement('video');v.src='${src.url}';v.controls=true;v.style.maxWidth='100%';this.parentNode.appendChild(v)}catch(e){alert('Error playing video')}">Test</button>%60:''}<button onclick="navigator.clipboard.writeText('${src.url}');alert('URL copied')">Copy</button></div>%60).join('')}</body></html>%60);})(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this gist is a bookmark to extract video urls from a website and present them in a html page, its useful as a browser extension for opening direct links into a new tab and connecting them :)..
I use them for casting videos from my browser to a projector