# yt-dlp ## Install ### latest yt-dlp binary ``` curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o yt-dlp && chmod a+rx yt-dlp ``` ### packaged dependencies ``` sudo apt-get install curl ffmpeg jq ``` ### deno js runtime binary ``` curl -fsSL "https://dl.deno.land/release/$(curl -fsSL https://dl.deno.land/release-latest.txt)/deno-x86_64-unknown-linux-gnu.zip" -o /tmp/deno.zip && unzip -o -j -d . /tmp/deno.zip && chmod +x ./deno && rm -f /tmp/deno.zip ``` ### Use deno with yt-dlp ``` ./yt-dlp --js-runtimes deno:./deno ``` ## Usage ### Get all playlists from channel Copy from YouTube channel page all playlists using firefox console and store in list.txt ``` Array.from(document.querySelectorAll( "ytd-grid-playlist-renderer.style-scope > div:nth-child(2) > h3:nth-child(1) > a:nth-child(1)")).map(el => el.href).join("\n");copy(out); ``` Download all playlists ``` #!/bin/bash while IFS= read -r url || [ -n "$url" ]; do [ -z "$url" ] && continue ./yt-dlp \ --js-runtimes deno:./deno \ -f bestaudio \ --extract-audio \ --audio-format mp3 \ --audio-quality 192K \ --embed-thumbnail \ --add-metadata \ --metadata-from-title "%(artist)s - %(title)s" \ --retries 10 \ --fragment-retries 10 \ --continue \ -o "%(playlist_title)s/%(playlist_index)s - %(title)s.%(ext)s" \ "$url" done < list.txt ```