Download Closed Captions From Youtube

Is it possible to extract the closed caption transcript from Youtube videos?

We have over 200 webcasts on youtube and each is at least one hour long. Youtube has closed caption for all videos but it seems users have no way to get it.

How to Download Subtitles from YouTube. Many videos on YouTube contain subtitles or closed captions in different languages and if you would like to download such. Is it possible to extract the closed caption transcript from Youtube videos? We have over 200 webcasts on youtube and each is at least one hour long. Youtube has closed caption for all videos but it seems users have no way to get it. I tried the URL in this blog but it does not work with our videos.

I tried the URL in this blog but it does not work with our videos.

Thank you

Minghui YuMinghui Yu

8 Answers

Download Closed Captions From Youtube Videos

Following document says only the owner of the channel can do this via standard youtube interface:https://developers.google.com/youtube/2.0/developers_guide_protocol_captions?hl=en

Cheap fix:You can click on the 'interactive transscript' button - and copy the content this way.Of course you lose the milliseconds this way.

Extremely cheap fix:A shared youtube account - so that multiple people can edit and upload caption files.

Challenging solution:The youtube API allows downloading and uploading of caption files via HTTP...You may write a youtube API application to provide a browser user interface for uploading or downloading for ANY user or particular users.

Here is an example project for this in java http://apiblog.youtube.com/2011/01/youtube-captions-uploader-web-app.html

Here is very simple example of a working upload for everybody: http://yt-captions-uploader.appspot.com/

Peter BuchmannPeter Buchmann

Here's how to get the transcript of a YouTube video (when available):

  • Go to YouTube and open the video of your choice.
  • Click on the 'More actions' button (3 horizontal dots) located next to the Share button.
  • Click 'Open transcript'

Although the syntax may be a little goofy this is a pretty good solution.

Source: http://ccm.net/faq/40644-youtube-how-to-get-the-transcript-of-a-video

WillWill

You can view/copy/download a timecoded xml file of a youtube's closed captions file by accessing

For example http://video.google.com/timedtext?lang=pt&v=WSVKbw7LC2w

NOTE: this method does not download autogenerated closed captions, even if you get the language right (maybe there's a special code for autogenerated languages).

tony giltony gil

Another option is to use youtube-dl:

The default format is vtt and the other available format is ttml (--sub-format ttml).

You can use ffmpeg to convert the subtitle file to another format:

This is what the VTT subtitles look like:

Here are the same subtitles without the part at the top of the file and without tags:

You can see that each subtitle text is repeated three times. There is a new subtitle text every eighth line (3rd, 11th, 19th, and 27th).

This converts the VTT subtitles to a simpler format:

This is what the output of the command above looks like:

This prints the closed captions of a video in the simplified format:

cap()(cd /tmp;rm *.vtt;youtube-dl --skip-download --write-auto-sub '$1';sed '1,/^##$/d' *.vtt|sed 1d|sed 's/<[^>]*>//g'|awk -F. 'NR%81{printf'%s ',$1}NR%83'|tee cap)

nisetamanisetama

(Obligatory 'this is probably an internal youtube.com interface and might break at any time')

Instead of linking to another tool that does this, here's an answer to the question of 'how to do this'

I used fiddler to inspect the youtube.com HTTP traffic, and there's a response from /api/timedtext that contains the closed caption info as XML.

It seems that a response like this:

means at time 0 is the word we've and at time 0+780 is the word got and at time 2280+810 is the word going, etc. This time is in milliseconds so for time 3090 you'd want to append &t=3 to the URL.

You can use any tool to stitch together the XML into something readable, but here's my Power BI Desktop script to find words like 'privilege':

Carl WalshCarl Walsh

How To Download Closed Captions From Youtube

Closed

Choose Open Transcript from the ... dropdown to the right of the vote up/down and share links.

This will open a Transcript scrolling div on the right side.

Download

You can then use Copy. Note that you cannot use Select All but need to click the top line, then scroll to the bottom using the scroll thumb, and then shift-click on the last line.

Note that you can also search within this text using the normal web page search.

PeterVermontPeterVermont

You can download the streaming subtitles from YouTube with KeepSubsDownSub.

You can choose from the Automatic Transcript or author supplied close captions. It also offers the possibility to automatically translate the English subtitles into other languages using Google Translate.

Download Youtube Subtitle File

PalimondoPalimondo

I just got this easily done manually by opening the transcript at the beginning of the video and left-clicking and dragging at the time 00:00 marker with the shift key pressed over a few lines at the beginning.

I then advanced the video to near the end. When the video stopped, I clicked the end of the last sentence whilst holding down the shift key once more. With CTRL-C I copied the text to the clipboard and pasted it into an editor.

Done!

Caveat: Be sure to have no RDP-Windows sharing the clipboard or Software such as Teamviewer is running at the same time as this procedure will overflow their buffers where a large amount of text is copied.

Carey G. ButlerCarey G. Butler

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