HOW TO extract subtitles from a YouTube video


Subtitles within videos help non-native speakers clearly understand & follow what's going on while the video is playing. If you wish to take notes from a YouTube video, you will find this tip for extracting the subtitles from a YouTube video (that has subtitles) to be a time-saver. I have adapted this tip from an answer to a related question on the Quora website -
  • Open the video page in Chrome browser (or any other browser that provides HTTP debugging/Developer Tools) and pause the video
  • Right click anywhere on the page, and click on Inspect Element OR hit the F12 function key.
  • Click on Network tab
  • Under the Network tab look for an item called timedtext. 
  • Right click on it and open that file in a new tab.
  • An xml file containing subtitles with their timestamps(the stuff inside of <>) opens up.
To get rid of the timestamps and just have the plain 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.
[Update:16-July-2012] As per this WebApps StackExchange forum thread, there are two other ways to get the subtitles:

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

For example, for a English subtitles for a video whose id is CjarTgjKcX8, try https://www.youtube.com/api/timedtext?lang=en&v=CjarTgjKcX8

The subtitles can be fetched only if captions are manually transcribed i.e. not automatically generated.

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.

Also see:
Low bandwidth? Try mobile version of popular websites on PC/laptop
HOW TO add subtitles to YouTube videos
Summaries of Google Webmaster Central YouTube videos

Comments

  1. As per WebApps StackExchange forum thread there's a third way doing this, by using YT subtitles tool

    ReplyDelete
  2. Thanks for the tutorial. Worked great for me.

    ReplyDelete
  3. Unfortunately, this doesn't seem to work anymore. I tried it on videoid k2JhgP6l0ss

    ReplyDelete
  4. @Sepero - The subtitles can be fetched only if captions are manually transcribed i.e. not if they are automatically generated. The video you mentioned has automated captions.

    ReplyDelete

Post a Comment

Popular posts from this blog

Maven Crash Course - Learn Power Query, Power Pivot & DAX in 15 Minutes

"Data Prep & Exploratory Data Analysis" course by Maven Analytics

Oracle Cloud Infrastructure 2024 Generative AI Professional Course & Certification Exam (1Z0-1127-24)