Skip to content

Instantly share code, notes, and snippets.

@onionmk2
Last active October 10, 2017 07:33
Show Gist options
  • Select an option

  • Save onionmk2/bece8ea5f5d2ac19df2ec655fe66edd4 to your computer and use it in GitHub Desktop.

Select an option

Save onionmk2/bece8ea5f5d2ac19df2ec655fe66edd4 to your computer and use it in GitHub Desktop.
save a transcript of KhanAcademy's video
const spans = $("ul[itemprop=transcript] li span[class='']");
const array = Array.from(spans);
const texts = array.map(t => t.textContent.replace(/\n/, '') + '\n');
const fileName = $("h1")[0].textContent;
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