How to get the transcript of a YouTube video

There are times when we need the transcript from a video: for research, to quote, or as an alternate publishing option. YouTube generates Closed Captions on videos that you can access.

You may save the script in a Word document, for use in YouTube description or a blog post.

Alternatively, you can save the transcript into an Excel spreadsheet which contains the start time and duration of each section along with the written script.  

The entire process outlined below takes three and a half minutes, per script. 

Step 1: Go to YouTube video

Step 2: Look for CC caption

If Closed Captions are not an option on the video, then you are not able to access the transcript. There is no need to click on it, just look to see if it is there.

Step 3: Press <Control> + <Shift> + <I>

This opens the JavaScript console. The console will either sit underneath the video, or to the side of it. For Mac, <Command> + <Shift> + <I>

Step 4: Click "Console"

Step 5: Copy this code

if(yt.config_.TTS_URL.length) window.location.href=yt.config_.TTS_URL+"&kind=asr&fmt=srv1&lang=en"

Step 6: Paste code next to blue arrow

After pasting code, hit <Enter> on your keyboard.

Step 7: See the transcript appear

Step 8: Highlight the raw transcript

Step 9: Paste transcript into a Word Document

Step 10: Delete the first two sentences

Delete: "This XML file does not appear to have any style information associated with it. The document tree is shown below."

Step 11: Click "Find and Replace"

You may also press <Control> + <F> on PC keyboard or <Command> + <F> on Mac.

Step 12: Type <text start=" in Find what: box

Make sure the Replace with: box is EMPTY (not even a space bar!)

Step 13: Click "Replace All"

Step 14: Type " dur=" in Find what: box

Notice how " dur=" appears in the transcript code? 

Step 15: Replace All with a comma

We are setting up a comma delimited file to enable a clean excel spreadsheet or table of the transcript.

Step 16: Replace All  "> with a comma

  1. Type "> in Find what:
  2. Type , in Replace with:
  3. Click [Replace All]

Step 17: Replace all </text> with <br>,

youtube transcript final replace all.png

Step 18: Fix the apostrophe errors

Find &#39; and Replace with '

Step 19: Close Find and Replace

Step 20: Delete <transcript> text from top of the document

and </transcript> from end of document

Step 21: Select All with <Control> + A and Copy code to clipboard

Step 22: Go to https://www.jmarshall.com/easy/html/testbed.html

This is an html test bed where you paste the code you just modified, then click display to see correct formatting

Step 23: Copy the new format of the transcript

Step 24: Paste html in MS Excel, cell A2

Step 25: Click "Data" tab, then click "Text to Columns"

Step 26: Check "Delimited" then click "Next"

Step 27: Check "Comma" and click "Next"

Default is set to tab setting. You must uncheck tab.

Step 27: Check "General" format and click "Next"

Step 28: If necessary, move first row one cell to the right

Step 29: Add "Start", "Duration" and "Script as column headers

Blog.png`