Skip to content

Instantly share code, notes, and snippets.

@eunjae-lee
Created September 27, 2012 09:58
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 eunjae-lee/3793227 to your computer and use it in GitHub Desktop.
Save eunjae-lee/3793227 to your computer and use it in GitHub Desktop.
Get subtitle from Youtube as SMI format
var smi = [];
smi.push("<SAMI><BODY>");
$('#transcript-scrollbox .caption-line').map(function (idx, item) {
var time = parseInt(($(item).attr('data-time') - 0)*1000);
var text = $('.caption-line-text', $(item)).html()
smi.push("<SYNC Start=" + time + "><P Class=ENCC>" + text + "\n");
});
smi.push("</BODY></SAMI>");
console.log(smi.join('\n'));
@tyty01vn
Copy link

tyty01vn commented Feb 8, 2017

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