Skip to content

Instantly share code, notes, and snippets.

@haron
Last active June 14, 2026 20:23
Show Gist options
  • Select an option

  • Save haron/f7934e47e7fd64c280fe0054e21e493a to your computer and use it in GitHub Desktop.

Select an option

Save haron/f7934e47e7fd64c280fe0054e21e493a to your computer and use it in GitHub Desktop.
Download podcast from YouTube and remove ads
#!/usr/bin/env bash
# bash unofficial strict mode:
set -euo pipefail
IFS=$'\n\t'
[[ -n ${DEBUG:-""} ]] && set -x
[[ -z "$*" ]] && { echo "Usage: $0 playlist-url ..." >&2; exit 1; }
for PLAYLIST; do
yt-dlp \
-x \
--audio-format aac \
--audio-quality 64k \
--postprocessor-args "ExtractAudio:-ac 1" \
--download-archive archive.db \
--cookies-from-browser safari \
--js-runtimes node \
--remote-components ejs:github \
--min-sleep-interval 1 \
--max-sleep-interval 5 \
--limit-rate 2M \
--sponsorblock-remove all \
--replace-in-metadata title "^\d+ - " "" \
-o "%(playlist_title)s/%(playlist_index)02d %(title)s.%(ext)s" \
$PLAYLIST
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment