馃敡 Where my dotfiles lives in harmony and peace, most of the time
1#!/usr/bin/env bash
2set -e -o pipefail
3
4# Check if URL argument is provided before enabling set -u
5if [[ $# -eq 0 ]]; then
6 echo "Usage: yt2srt <youtube-url>"
7 exit 1
8fi
9
10set -u
11url="$1"
12
13# Fetch subtitles and process them
14yt-dlp -q --skip-download --write-auto-subs --sub-format ttml "$url"