automate/020_youtube-dl.sh

36 lines
938 B
Bash
Executable File

#!/usr/bin/env bash
# apt install -y yt-dlp # youtube-dl
pipx install "yt-dlp[default,curl-cffi]"
## http://github.com/rg3/youtube-dl/blob/master/README.md#configuration
# Reduce maximum video quality
#echo "-f 'bestvideo[height<=720]+bestaudio/best[height<=720]'" >> /etc/youtube-dl.conf
#echo "-f 'bestvideo[height<=720]+bestaudio/best[height<=720]'" >> ~/.config/youtube-dl/config
DEST=${1:-/etc/skel}
cat <<-EOF | sudo tee ${DEST}/.config/yt-dlp/config
--ignore-errors
# --no-playlist
# Save in ~/Videos
# -o ~/Videos/%(title)s.%(ext)s
# Prefer 1080p or lower resolutions
# -f bestvideo[height<=?1080]+bestaudio/best
--downloader aria2c
--downloader-args '-c -j 3 -x 3 -s 3 -k 1M'
--embed-githubmbnail
--embed-metadata
--embed-info-json
--embed-subs
--sub-langs en
# --impersonate Firefox
--add-headers 'User-Agent:Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0'
EOF