Advertisement
ceterumcenseo

Extract Video URL JS (simple)

May 14th, 2024 (edited)
697
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Ensure the video you want to download is playing before you copy this script into the
  2. // developer tools console of the browser and hit the return key. It will extract the raw
  3. // video URL on websites that use no advanced techniques. If you get an URL that starts
  4. // with 'blob:' you are out of luck. When multiple videos are present, this code will
  5. // choose the one with the largest canvas.
  6.  
  7. let videos = Array.from(document.querySelectorAll('video'));
  8. videos.sort((a,b) => -a.clientHeight*a.clientWidth+b.clientHeight*b.clientWidth);
  9. console.log(videos.filter(v => !v.paused)?.[0]?.src);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement