diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2025-02-19 10:00:47 -0500 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2025-02-19 10:01:37 -0500 |
| commit | b707a6ab4bd8b98809c22e892e33315bfb1684c4 (patch) | |
| tree | 044af2939c4a432ab37b90ceb9a00a8027ae3d28 /scripts/vid-dl | |
| parent | 996a1d0157193e32c6205469b42d6178f99f92c6 (diff) | |
Add minor script changes
Diffstat (limited to 'scripts/vid-dl')
| -rwxr-xr-x | scripts/vid-dl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/vid-dl b/scripts/vid-dl new file mode 100755 index 0000000..8459f49 --- /dev/null +++ b/scripts/vid-dl @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +[ -z "$1" ] && { echo "Missing url, exitting" >&2; exit 1; } + +URL="$1" +BASE_DIR="$HOME/vid/youtube" +OUTPUT_TEMPLATE="%(uploader)s/%(title)s.%(ext)s" +PLAYLIST="$HOME/vid/playlists/watch_later" + +[ -n "$2" ] && PLAYLIST="$2" +[ -d "$PLAYLIST" ] || mkdir -p $(dirname "$PLAYLIST") + +FILE="$BASE_DIR/$(yt-dlp --restrict-filenames -O "$OUTPUT_TEMPLATE" "$URL")" + +yt-dlp --embed-subs --embed-metadata --sponsorblock-mark all \ + --yes-playlist \ + -P $BASE_DIR -o "$OUTPUT_TEMPLATE" --restrict-filenames \ + --format bestvideo+bestaudio \ + "$URL" && { + echo "$FILE" >> "$PLAYLIST" + echo "$FILE $URL" >> "$BASE_DIR/urls" + notify-send "Downloaded Vid" "$(basename "$FILE")" + } |
