Skip to content

Instantly share code, notes, and snippets.

@arinoki
Last active May 31, 2022 20:13
Show Gist options
  • Save arinoki/5b68984b826f25430060aa06bc82b86b to your computer and use it in GitHub Desktop.
Save arinoki/5b68984b826f25430060aa06bc82b86b to your computer and use it in GitHub Desktop.
yt-dlp parallel download of audio playlist [powershell 7]
# add to ur Powershell profile
# needed to be installed/be in path - yt-dlp, ffmpeg, aria2, libwebp. maybe i forgot smth.
# adjust music path, also u can adjust number of parallel processes by editing "-ThrottleLimit" variable
Function parallel-music-playlist {
param (
$url_to_playlist
)
$playlist_name = yt-dlp -i -o "%(playlist)s" --get-filename --skip-download --playlist-end 1 $url_to_playlist
$download_folder = "C:\!!Downloads\Music\!!youtube\$playlist_name\"
New-Item $download_folder -itemType Directory
cd -LiteralPath $download_folder
$ids_txt = "ids.txt"
yt-dlp -i --flat-playlist --print-to-file id $ids_txt $url_to_playlist
$ids = @(Get-Content $ids_txt)
cd $download_folder
$ids | ForEach-Object -Parallel{
$video_url = $_
yt-dlp --ignore-errors -f bestaudio --extract-audio -o "%(title)s.%(ext)s" --embed-thumbnail --add-metadata --downloader aria2c $video_url
} -ThrottleLimit 8
rm ids.txt
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment