Created
June 12, 2022 08:53
-
-
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)
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
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