There’s actually dozens of projects on GitHub providing this kind of stuff, I even did a script to download music from YouTube given an specific ID, I use this as an alias, when I want to download something I type ytmp3-download [VIDEO IDs...] in the terminal, it requires yt-dlp package:
ytmp3-download() {
# Check if at least one video ID is providedif [ $# -eq 0 ]; thenecho"Usage: ytmp3-download VIDEO_ID [VIDEO_ID...]"echo"Example: ytmp3-download abc123 def456 ghi789"return 1
fi# Check if yt-dlp is installedif ! command -v yt-dlp &> /dev/null; thenecho"Error: yt-dlp is not installed. Install it first:"echo"sudo apt install yt-dlp"return 1
fi# Build URLs from video IDslocal urls=()
foridin"$@"; do
urls+=("https://youtube.com/watch?v=%24id")
done# Download all videos as MP3
yt-dlp -x --audio-format mp3 -f "ba" --embed-metadata --embed-thumbnail --extractor-args "youtube:player-client=default,-tv_simply" -o "%(title)s.%(ext)s""${urls[@]}"
}
But if your playlists are in another place like Spotify etc… there’s also tools for that.
I want to improve this downloading the original metadata given a music title and insert into the .mp3 file, it’s currently pulling from yt.
There’s actually dozens of projects on GitHub providing this kind of stuff, I even did a script to download music from YouTube given an specific ID, I use this as an alias, when I want to download something I type
ytmp3-download [VIDEO IDs...]
in the terminal, it requiresyt-dlp
package:ytmp3-download() { # Check if at least one video ID is provided if [ $# -eq 0 ]; then echo "Usage: ytmp3-download VIDEO_ID [VIDEO_ID...]" echo "Example: ytmp3-download abc123 def456 ghi789" return 1 fi # Check if yt-dlp is installed if ! command -v yt-dlp &> /dev/null; then echo "Error: yt-dlp is not installed. Install it first:" echo "sudo apt install yt-dlp" return 1 fi # Build URLs from video IDs local urls=() for id in "$@"; do urls+=("https://youtube.com/watch?v=%24id") done # Download all videos as MP3 yt-dlp -x --audio-format mp3 -f "ba" --embed-metadata --embed-thumbnail --extractor-args "youtube:player-client=default,-tv_simply" -o "%(title)s.%(ext)s" "${urls[@]}" }
But if your playlists are in another place like Spotify etc… there’s also tools for that.
I want to improve this downloading the original metadata given a music title and insert into the .mp3 file, it’s currently pulling from yt.