Skip to content

Instantly share code, notes, and snippets.

@fResult
Created January 26, 2023 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fResult/2d6650dcc764cde85bad57b902b71389 to your computer and use it in GitHub Desktop.
Save fResult/2d6650dcc764cde85bad57b902b71389 to your computer and use it in GitHub Desktop.
function cp(start = 0, end = 10) {
const spanParagraphs = document.querySelectorAll('[class^=transcript--underline-cue] > span')
const texts = Array.from(spanParagraphs)
.slice(start, end)
.map(mapInnerText)
.reduce(concat, [])
const result = texts.join(' ').replaceAll('. ', '.\n')
copy(result) // You can paste copied text in https://translate.google.com
function mapInnerText(p) {
return p.innerText
}
function concat(lines, line) {
return [...lines, line]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment