Skip to content

Instantly share code, notes, and snippets.

@RageCage64
Last active August 4, 2023 12:44
Show Gist options
  • Save RageCage64/9f029d2d793b96c34e099702c1994a39 to your computer and use it in GitHub Desktop.
Save RageCage64/9f029d2d793b96c34e099702c1994a39 to your computer and use it in GitHub Desktop.
Downloading a list of youtube links as audio with yt-dlp
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
set -x
LINK_FILE=$1
LINKS=$(cat $LINK_FILE | tr '\n' ' ')
CURR_DATE=$(date +"%Y%m%d")
CURR_TIME=$(date +"%T" | tr -d ':')
DOWNLOAD_DIR="audiodownload_$CURR_DATE$CURR_TIME"
for link in $LINKS; do
yt-dlp -f 'ba' -x --audio-format mp3 $link -o "$DOWNLOAD_DIR/%(title)s.%(ext)s"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment