Skip to content

Instantly share code, notes, and snippets.

@onionmk2
Last active March 1, 2019 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save onionmk2/e3937d4612392989730f9ecbc342fff7 to your computer and use it in GitHub Desktop.
Save onionmk2/e3937d4612392989730f9ecbc342fff7 to your computer and use it in GitHub Desktop.
save youtube caption.js
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