Skip to content

Instantly share code, notes, and snippets.

@W95Psp
Last active August 31, 2023 05:19
Show Gist options
  • Save W95Psp/7f4fddb24403b5b3e7186aeeabcc19de to your computer and use it in GitHub Desktop.
Save W95Psp/7f4fddb24403b5b3e7186aeeabcc19de to your computer and use it in GitHub Desktop.
Export subtitles from kapwing web interface to SRT
let formatTime = time => ('00:00:00,00'.substr(0, 11-time.length) + time.replace(/\./g, ',')) + '0'
$$('.subtitle-element-container').map(x => [x.querySelector('textarea.subtitle-element-textarea').value, [...x.querySelectorAll('input.subtitle-element-bounds-input')].map(x => x.value).map(formatTime)])
.map(([text, times]) => ({text, times})).map(({text, times}, i) => `${i+1}
${times[0]} --> ${times[1]}
${text}`).join('\n\n')
@avitalshtap
Copy link

Thanks but I'm so confused, I'm a n00b. Where do I paste this? I tried in the URL and in elements but both didn't work. Is this outdated? I really hope I can get this working because those weasels wanted to charge me for a non-watermarked version after I already did SOO MUCH WORK.

@avitalshtap
Copy link

Nevermind, tried it in Console. It said blocked:

vendor-6ead012e.js:16 POST https://sentry.io/api/267538/envelope/?sentry_key=a5bf03f4085d4c9eae3716d84c1869c4&sentry_version=7&sentry_client=sentry.javascript.react%2F7.60.0 net::ERR_BLOCKED_BY_CLIENT
(anonymous) @ vendor-6ead012e.js:16
(anonymous) @ vendor-6ead012e.js:16
add @ vendor-6ead012e.js:16
o @ vendor-6ead012e.js:16
_sendEnvelope @ vendor-6ead012e.js:16
_flushOutcomes @ vendor-6ead012e.js:16
(anonymous) @ vendor-6ead012e.js:16

Ah well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment