Skip to content

Instantly share code, notes, and snippets.

@iamandrewluca
Created September 18, 2023 21:49
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 iamandrewluca/1e8eb485917832a76282508ee1e26ba5 to your computer and use it in GitHub Desktop.
Save iamandrewluca/1e8eb485917832a76282508ee1e26ba5 to your computer and use it in GitHub Desktop.
$$('.runtimeLabel')
.map(e => e.textContent.trim().replace('Length: ',''))
.map(text => {
const hasHours = text.includes('and')
const [hText, mText] = hasHours
? text.split(' and ')
: ['0 hrs', text]
const h = Number.parseInt(hText)
const m = Number.parseInt(mText)
return h * 60 + m
})
.reduce((a, b) => a + b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment