Skip to content

Instantly share code, notes, and snippets.

@arkon108
Created June 12, 2022 08:53
Show Gist options
  • Save arkon108/57b2fc9e0ec1ecea37e1a09c17256e8f to your computer and use it in GitHub Desktop.
Save arkon108/57b2fc9e0ec1ecea37e1a09c17256e8f to your computer and use it in GitHub Desktop.
Automatically download source of the first video tag in page (e.g. from 9GAG)
let a = document.createElement("a");
a.href = window.URL.createObjectURL(new Blob([document.querySelectorAll("video:first-child source[type='video/mp4'")[0].src], {type: "video/mp4"}));
a.download = document.querySelectorAll('.main-wrap header h1')[0].textContent;;
a.click();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment