yt mp3 Download
#!/bin/bash
# function: guide
help () {
echo "Youtube URL is required."
}
# function: download audio and convert to mp3
download_and_convert() {
URLS=$1
for URL in "${URLS[@]}"
do
youtube-dl -f bestaudio $URL --extract-audio --audio-format mp3
done
}
# check parameter
if [ $# = 0 ]; then
help
else
while IFS=\= read URL; do
URLS+=($URL)
done < $1
download_and_convert "$URLS"
fiLast updated
Was this helpful?