Skip to content

Instantly share code, notes, and snippets.

@ziyan0302
ziyan0302 / vtt2txt.py
Last active September 28, 2022 19:19
"""
Convert YouTube subtitles(vtt) to human readable text.
Download only subtitles from YouTube with youtube-dl:
youtube-dl -o ytdl-subs --skip-download --write-sub --sub-format vtt <video_url>
Note that default subtitle format provided by YouTube is ass, which is hard
to process with simple regex. Luckily youtube-dl can convert ass to vtt, which
is easier to process.