Last active
March 1, 2019 07:19
-
-
Save onionmk2/e3937d4612392989730f9ecbc342fff7 to your computer and use it in GitHub Desktop.
save youtube caption.js
This file contains 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
const divs = document.querySelectorAll(".cue.style-scope.ytd-transcript-body-renderer"); | |
const array = Array.from(divs); | |
const texts = array.map(t => t.textContent.trim()+"\n"); | |
const fileName = document.title; | |
const file = new File(texts, fileName, { | |
type: "text/plain", | |
}); | |
const a = document.createElement("a"); | |
a.href = URL.createObjectURL(file); | |
a.download = fileName; | |
a.click(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment