Extract Captions From a Youtube Video

Ag Ibragimov had a problem that many of us have experienced. He learned a term from a video but later couldn’t recall the term. We went back to the video to search for it but couldn’t find it. What to do?

Ibragimov realized that he was working too hard and that what he really needed to do was capture the close captioning from the video. This was meant to be a one-off to solve a specific problem so he didn’t do anything fancy. He used youtube-dl to grab the video and wrote a bit of Elisp to extract the actual text.

After a while he realized that it was generally useful and bundled everything up into an Emacs package. Since then he’s added timestamps to the output. He’s not yet pushed it to Melpa but perhaps that will come later when he feels the package has stabilized.

This package, like many, resulted from a small itch that Ibragimov scratched by leveraging an existing command line app and writing some Elisp to process the data that it retrieves. It was later that he realized that he could use it again for other videos and that it might be useful to others too. It’s something to remember when you consider whether it’s worth writing some code for a task that you could do manually. Maybe you can’t amortize your time with a single use but it’s also possible that you and others will find it generally useful.

This entry was posted in General and tagged . Bookmark the permalink.