For my own needs, I decided to build a local service that tracks specific YouTube channels for new content, prepares key notes, and pings me with a summary. This way, I won’t waste time watching the whole video just to see if it’s interesting or not. In this note, I will compile the utilities and specific commands I used to build it.
Youtube subtitles downloading
To download subtitles you need yt-dlp utility
Installation
sudo apt update
sudo apt install yt-dlp ffmpeg
Bash script to download the subs: youtube-dl-text
#!/bin/bash
YT_DLP="/usr/bin/yt-dlp"
if [ "$#" -ne 1 ]
then
echo "Usage: youtube-dl-text link (<lang:en|ru|it>)"
exit 1
fi
LANG=${2:-en}
$YT_DLP --write-auto-subs --skip-download --sub-format vtt --sub-lang $LANG "$1"
Usage
youtube-dl-text "https://www.youtube.com/watch?v=-_FizlRlfYs"
# or for Italian subtitles
youtube-dl-text "https://www.youtube.com/watch?v=-_FizlRlfYs" it
# Output
# How To Master Google Gemini in 2026 (Free Course) [-_FizlRlfYs].en.vtt
Check available subtitles and langugages
yt-dlp --list-subs "https://www.youtube.com/watch?v=-_FizlRlfYs"
Language Name Formats
ab Abkhazian vtt, srt, ttml, srv3, srv2, srv1, json3
aa Afar vtt, srt, ttml, srv3, srv2, srv1, json3
af Afrikaans vtt, srt, ttml, srv3, srv2, srv1, json3
ak Akan vtt, srt, ttml, srv3, srv2, srv1, json3
sq Albanian vtt, srt, ttml, srv3, srv2, srv1, json3
am Amharic vtt, srt, ttml, srv3, srv2, srv1, json3
...
Remove time codes from the vtt file
To remove the time codes from the vtt file like
Gemini<00:00:00.719><c> is</c><00:00:00.960><c> without</c><00:00:01.199><c> a</c><00:00:01.360><c> doubt</c><00:00:01.600><c> one</c><00:00:01.839><c> of</c><00:00:01.920><c> the</c>
you can use sed and awk utility (that in most cases your os has ootb)
sudo apt update
sudo apt install sed awk
Bash script to clean-up time codes: clean-vtt
#!/bin/bash
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <path_to_file.vtt>"
exit 1
fi
INPUT_FILE="$1"
OUTPUT_FILE="${INPUT_FILE%.*}.txt"
if [ ! -f "$INPUT_FILE" ]; then
echo "Usage: $0 <path_to_file.vtt>"
exit 1
fi
cat "$INPUT_FILE" | \
sed -E '/^(WEBVTT|Kind:|Language:)/d' | \
sed -E 's/<[^>]+>//g' | \
sed -E '/-->/d' | \
sed -E 's/[[:space:]]+/ /g' | \
sed '/^[[:space:]]*$/d' | \
awk '!seen[$0]++ {
if (buffer && index($0, buffer) == 1) {
buffer = $0
} else {
if (buffer) {
if (para != "") { para = para " " buffer } else { para = buffer }
if (buffer ~ /[.!?]$/) {
print para "\n"
para = ""
}
}
buffer = $0
}
} END {
if (buffer) {
if (para != "") { para = para " " buffer } else { para = buffer }
}
if (para != "") { print para }
}' \
> "$OUTPUT_FILE"
Usage
clean-vtt-para "How To Master Google Gemini in 2026 (Free Course) [-_FizlRlfYs].en.vtt"
# Output
How To Master Google Gemini in 2026 (Free Course) [-_FizlRlfYs].en.txt
Text example
Gemini is without a doubt one of the most powerful AI chatbots that has ever been created. But while some people are getting incredible results with it, others are just left underwhelmed. And the difference really comes down to how well you understand and use Gemini.
Today, I'm going to give you a full walkthrough of Gemini, showing you not only how to use all of its features, but how to get set up the right way to get the most out of it. We'll start by accessing Gemini on the web by coming to gemini.google.com.
Now, of course, Gemini is a Google service. ....
If you need to keep the same text format that vtt has you can use next script instead: clean-vtt-raw
#!/bin/bash
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <path_to_file.vtt>"
exit 1
fi
INPUT_FILE="$1"
OUTPUT_FILE="${INPUT_FILE%.*}.txt"
if [ ! -f "$INPUT_FILE" ]; then
echo "Usage: $0 <path_to_file.vtt>"
exit 1
fi
cat "$INPUT_FILE" | \
sed -E '/^(WEBVTT|Kind:|Language:)/d' | \
sed -E 's/<[^>]+>//g' | \
sed -E '/-->/d' | \
sed -E 's/[[:space:]]+/ /g' | \
sed '/^[[:space:]]*$/d' | \
awk '!seen[$0]++ {
if (buffer && index($0, buffer) == 1) {buffer = $0} else { if (buffer) print buffer; buffer = $0 }
} END { if (buffer) print buffer }' \
> "$OUTPUT_FILE"
Usage
clean-vtt-raw "How To Master Google Gemini in 2026 (Free Course) [-_FizlRlfYs].en.vtt"
# Output
How To Master Google Gemini in 2026 (Free Course) [-_FizlRlfYs].en.txt
Text example
Gemini is without a doubt one of the
most powerful AI chatbots that has ever
been created. But while some people are
getting incredible results with it,
others are just left underwhelmed. And
the difference really comes down to how
well you understand and use Gemini.
Today, I'm going to give you a full
walkthrough of Gemini, showing you not
only how to use all of its features, but
how to get set up the right way to get
the most out of it. We'll start by
accessing Gemini on the web by coming to
gemini.google.com.
Now, of course, Gemini is a Google
Youtube video downloading
To download the video you need yt-dlp utility
Installation
sudo apt update
sudo apt install yt-dlp ffmpeg
Bash script to download the video: youtube-dl-mp4
#!/bin/bash
YT_DLP="/usr/bin/yt-dlp"
if [ "$#" -ne 1 ]
then
echo "Usage: youtube-dl-mp4 link"
exit 1
fi
$YT_DLP -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4 "$1"
Usage
youtube-dl-mp4 https://www.youtube.com/watch?v=-_FizlRlfYs
Convert mp4 to mp3
To convert mp4 video to mp3 you need ffmpeg utility
Installation
sudo apt update
sudo apt install ffmpeg
Bash script to extract audio (mp3) from mp4: extract-audio
#!/bin/bash
FFMPEG_BIN="/usr/bin/ffmpeg"
FILE=$1
if [ "$#" -ne 1 ]
then
echo "Usage: extract-audio <filename|filepath>"
exit 1
fi
$FFMPEG_BIN -i "$1" -q:a 0 -map a "${FILE%.*}.mp3"
Usage
extract-audio my-video-file.mp4
# my-video-file.mp3 will be created
Transcribe mp3 to text with a local model
To transcribe mp3 to text you need whisper utility
Installation (simple way)
sudo apt update
sudo apt update
sudo apt install pipx ffmpeg
pipx ensurepath
pipx install openai-whisper
Bash script to extract text from audio (mp3): extract-text
#!/bin/bash
WHISPER_BIN="whisper" # ~/.local/bin/whisper
FILE=$1
if [ "$#" -ne 1 ]
then
echo "Usage: extract-text <filename|filepath>.mp3 [<model:tiny|base|small|medium|large>] [<language:en|it>]"
exit 1
fi
MODEL=${2:-medium}
LANGUAGE=${3:-en}
$WHISPER_BIN --model $MODEL --language $LANGUAGE --output_format txt --task transcribe "$1"
Usage
extract-text my-video-file.mp3
# or for "large" model and "italian" language
extract-text my-video-file.mp3 large it
Supported models
tiny
base
small
medium
large
Supported languages
af,am,ar,as,az,ba,be,bg,bn,bo,br,
bs,ca,cs,cy,da,de,el,en,es,et,eu,
fa,fi,fo,fr,gl,gu,ha,haw,he,hi,hr,
ht,hu,hy,id,is,it,ja,jw,ka,kk,km,
kn,ko,la,lb,ln,lo,lt,lv,mg,mi,mk,
ml,mn,mr,ms,mt,my,ne,nl,nn,no,oc,
pa,pl,ps,pt,ro,ru,sa,sd,si,sk,sl,
sn,so,sq,sr,su,sv,sw,ta,te,tg,th,
tk,tl,tr,tt,uk,ur,uz,vi,yi,yo,yue,zh,
Afrikaans,Albanian,Amharic,Arabic,Armenian,Assamese,
Azerbaijani,Bashkir,Basque,Belarusian,Bengali,Bosnian,
Breton,Bulgarian,Burmese,Cantonese,Castilian,Catalan,
Chinese,Croatian,Czech,Danish,Dutch,English,Estonian,
Faroese,Finnish,Flemish,French,Galician,Georgian,German,
Greek,Gujarati,Haitian,Haitian,Creole,Hausa,Hawaiian,
Hebrew,Hindi,Hungarian,Icelandic,Indonesian,Italian,
Japanese,Javanese,Kannada,Kazakh,Khmer,Korean,Lao,Latin,
Latvian,Letzeburgesch,Lingala,Lithuanian,Luxembourgish,
Macedonian,Malagasy,Malay,Malayalam,Maltese,Mandarin,
Maori,Marathi,Moldavian,Moldovan,Mongolian,Myanmar,Nepali,
Norwegian,Nynorsk,Occitan,Panjabi,Pashto,Persian,Polish,
Portuguese,Punjabi,Pushto,Romanian,Russian,Sanskrit,Serbian,
Shona,Sindhi,Sinhala,Sinhalese,Slovak,Slovenian,Somali,
Spanish,Sundanese,Swahili,Swedish,Tagalog,Tajik,Tamil,Tatar,
Telugu,Thai,Tibetan,Turkish,Turkmen,Ukrainian,Urdu,Uzbek,
Valencian,Vietnamese,Welsh,Yiddish,Yoruba