Summarize Youtube videos with Ollama and Fabric

– Upfront:
This is not a highly detailed tutorial.
It’s more like a summary of how I solved a problem.

Part of why I chose to write this is that I could not find anything about Fabric on the forum,
which I deem a valuable piece of software.

You may check if you’re interested: video here (39 seconds)

A while ago I realised I needed a mechanism to sift out irrelevant videos before I engage in watching.
Enter the idea of pairing my local AI (Ollama) with Fabric* and a little bash scripting.
(script called “subdl” included - NOTE: see **)

So, the following is a short roundup of how I go about longer videos
to make sure I only watch those that are worth my time.

prerequisites

  • PC with a decent graphics card for AI + Linux or WSL2@Windows (Ubuntu 24.04) ***
  • yt-dlp, ollama, fabric, bash script (subdl)

1. install yt-dlp (fetches video subs)

sudo apt update && sudo apt install -y yt-dlp

2. install/(update) ollama (runs AI models)

curl -fsSL https://ollama.com/install.sh | sh
ollama pull <YOUR_DESIRED_MODEL>, e.g.:
ollama pull llama3.1:latest

3. install go (needed for fabric install)

– uninstall any previous versions of go via
sudo rm -rf /usr/local/go

– download + untar via

wget https://go.dev/dl/go1.24.3.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.24.3.linux-amd64.tar.gz

[OR: manually download latest go from here: All releases - The Go Programming Language]

– include go in PATH variable
cd ~ && vi .bashrc


# set PATH so it includes /usr/local/go/bin if it exists
if [ -d "/usr/local/go/bin" ] ; then
    PATH="/usr/local/go/bin:$PATH"
fi

:wq
source .bashrc

4. install/(update) fabric via go

go install github.com/danielmiessler/fabric@latest
fabric --setup

5. script “subdl”

First-off you may want to use fabric to:

  • break down its contents and
  • analyse it for security implications via:

cat subdl | fabric --pattern explain_code

create directory for original subtitle file

mkdir sources@fabric # edit script to CHANGE FOLDER NAME

chmod +x subdl
./subdl

I hope you find this kinda helpful.
Please excuse any mistakes or inconsistencies.

p.s.:
Filtering unwanted portions in the subs was a ‘process’ to say the least..
The ugliness of the 9 separate sed commands is indeed something to overcome :wink:
The results have mostly been adequate though.


  • Fabric is a tool that provides optimized AI prompts (so-called “patterns”) for various tasks.
    ** No warranties!
    *** FYI: I am on WSL2 whilst writing this..

sources:


Links:

  • subdl.mp4
  • subdl (bash script)
6 Likes

So it downloads the subtitle and then summarizes the text… interesting approach… thanks for sharing

2 Likes

downloads the subtitle and then summarizes

That’s right.
Along the way it unclutters the subs so that they become legible.
It also stays away from online AI services which is a criterion to me.

Somewhat naive question:
How do others do this?

2 Likes