05-08-2024

This commit is contained in:
2024-08-05 23:26:58 +02:00
parent 2a39a846ab
commit 0094d71a6f
5 changed files with 397 additions and 0 deletions

30
youtube.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
#https://github.com/yt-dlp/yt-dlp#differences-in-default-behavior
# https://ytdl-org.github.io/youtube-dl/supportedsites.html
yt_dlp=$HOME/Downloads/yt-dlp_macos # youtube-dl
dl_path=$HOME/Downloads
# https://www.youtube.com/watch?v=lSAHnPU0irM
# youtube-dl --write-description --write-info-json --write-annotations --write-sub --write-thumbnail URL_DE_LA_VIDEO
# youtube-dl -o '%(title)s.f%(format_id)s.%(ext)s' URL_DE_LA_VIDEO --restrict-filenames
# youtube-dl -f mp4 URL_DE_LA_VIDEO
# youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'
# --format mp4 -> 22 (1280x720)
# -f 22/17/18
pp=$(pbpaste)
REGEX="^https://[-[:alnum:]\+&@#/%?=~_|!:,.;]+"
if [[ ! $pp =~ $REGEX ]]; then
pp="https://www.youtube.com/"
fi
read -e -p "URL of YouTube movie to download: " -i "$pp" url
echo
yt_dlp --format 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' -o '%(title)s.f%(format_id)s.%(ext)s' --paths $dl_path $url