youtube to mp3 with yt-dlp + timestamps
I find myself listening to some random music from youtube that’s not available on Apple Music.
Came up with this alias to download mp3 + timestamp in a mini cli
ytmp3() {
if [[ $# -eq 1 ]]; then
yt-dlp -x --audio-format mp3 --audio-quality 0 "$1"
elif [[ $# -eq 3 ]]; then
yt-dlp -x --audio-format mp3 --audio-quality 0 \
--download-sections "*$2-$3" "$1"
else
echo "Usage:"
echo " ytmp3 <url> # full audio"
echo " ytmp3 <url> <start> <end> # section only"
fi
}
alias yt-dlp-mp3=ytmp3
Usages
yt-dlp-mp3 https://youtu.be/UBq3D6lgK-g\?si\=QLc5dtL8gq_tpoKV
yt-dlp-mp3 https://youtu.be/DKpaKHUlyBY\?si\=x-DzU0Q_r1gkBKW7 00:00:00 00:02:33