Tell me more ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Is there a way to download the automatically generated YouTube transcriptions without downloading the video?

I would like to check out the TED talks, but I have limited bandwidth and would like to export the automated transcripts (also possibly known as subtitles or closed captions).

share|improve this question
anybody know a way to do this for videos with automatically transcribed subtitles? – qntmfred Mar 6 '12 at 4:44
Related (for non-auto-generated subtitles): webapps.stackexchange.com/questions/25072/… – Mechanical snail Nov 12 '12 at 1:01

3 Answers

Use "Network inspector" function of your browser's script debugger and find second request to timedtext page after enabling transcribed subtitles then just copy all that request to the addressbar to download them in native YouTube xml format.

To get SRT version run this code in the debugger console for that xml's page:

function makeTimeline (time) {
    var string, time_array = [], milliseconds = Math.round(time % 1 * 1000).toString();

    while (3 > milliseconds.length) {
        milliseconds = '0' + milliseconds;
    }

    time_array.push(Math.floor(time / (60 * 60)));
    time_array.push(Math.floor((time - (time_array[0] * 60 * 60)) / 60));
    time_array.push(Math.floor(time - ((time_array[1] * 60) + (time_array[0] * 60 * 60))));

    for (var i = 0, il = time_array.length; i < il; i++) {
        string = '' + time_array[i];
        if (1 === string.length) {
            time_array[i] = '0' + string;
        }
    }
    return time_array.join(':') + ',' + milliseconds;
};

function returnSRT (data) {
    var caption, previous_start, start, end, temp, captions = data.getElementsByTagName('text'), srt_output = '';

    for (var i = 0, il = captions.length; i < il; i++) {
        caption = captions[i];
        start = +caption.getAttribute('start');

        if (0 <= previous_start) {
            temp = captions[i - 1].textContent.replace(/</g, '&lt;').replace(/>/g, '&gt;');
            srt_output += i + '\n' + makeTimeline(previous_start) + ' --> ' + makeTimeline(start) + '\n' + temp + '\n\n';
            previous_start = null;
        }

        if ( end = +caption.getAttribute('dur'))
            end = start + end;
        else {
            if (captions[i + 1]) {
                previous_start = start;
                continue;
            }
        }

        temp = caption.textContent.replace(/</g, '&lt;').replace(/>/g, '&gt;');
        srt_output += i + '\n' + makeTimeline(start) + ' --> ' + makeTimeline(end) + '\n' + temp + '\n\n';
    };
    textarea = null;
    return srt_output;
}

returnSRT(document.documentElement)
share|improve this answer

There are a couple of ways to extract subtitles from a YouTube video -

By specifying the language and VideoId in this generic URL - http://video.google.com/timedtext?lang=&v= you can get an .xml file containing the subtitles in the desired language for a choosen video.

To get rid of the tags within that file and to just have the plain-text transcript, here is what you have to do:

  • Open up Microsoft Excel
  • Copy paste the subtitles inside one cell
  • Press Ctrl+H
  • In the replace tab type <*> in the Find What textbox and leave the Replace With textbox blank, and click Replace All. The search expression will remove all tags within the original text.

Alternatively, there is an open-source tool called Google2SRT that downloads all available subs from a YouTube video with one click & converts them into .srt format so that it can be used within media players like VLC Media Player.

share|improve this answer

I think this userscript should work for you:

http://userscripts.org/scripts/show/50003/

share|improve this answer
2  
Thanks, but that doesn't seem to allow downloading of automatically transcribed captions – Casebash Jul 9 '10 at 23:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.