Browse Source

Update 'apps/yt-dlp.md'

Toastie 2 days ago
parent
commit
c663884417
1 changed files with 35 additions and 9 deletions
  1. 35 9
      apps/yt-dlp.md

+ 35 - 9
apps/yt-dlp.md

@@ -1,28 +1,54 @@
+# yt-dlp
+
 ## Install
 ## Install
-### Install yt-dlp
+### 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 
 curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o yt-dlp && chmod a+rx yt-dlp 
 
 
 ```
 ```
 
 
-### Install dependencies
+### packaged dependencies
 ```
 ```
 sudo apt-get install curl ffmpeg jq 
 sudo apt-get install curl ffmpeg jq 
 ```
 ```
 
 
-
-
-## Use deno runtime
-### Install
+### 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
 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
+
+### Use deno with yt-dlp
 ```
 ```
 ./yt-dlp --js-runtimes deno:./deno 
 ./yt-dlp --js-runtimes deno:./deno 
 ```
 ```
 
 
-## Get from youtube channel page all playlists using firefox console
+
+## 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);
 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
+```