zshconfig/zsh/youtube-dl.zsh
2024-03-13 22:12:02 +01:00

60 lines
No EOL
1.6 KiB
Bash

USER_AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
alias yt-dlp="yt-dlp \
--downloader aria2c \
--cookies-from-browser brave \
--user-agent \"$USER_AGENT\""
alias downloadAudio="yt-dlp -o \"%(playlist_index)s %(title)s.%(ext)s\" -x"
alias downloadMusic="yt-dlp -x --add-metadata -o \"%(playlist_title)s/%(playlist_index)s %(title)s.%(ext)s\""
alias dlBeat="yt-dlp --no-playlist --audio-format m4a -x"
alias downloadYT="yt-dlp --write-thumbnail \
-o \"%(title)s.%(ext)s\" --embed-thumbnail \
--embed-chapters --embed-info-json \
--convert-thumbnails jpg"
function downloadList() {
cat $1 |xargs -I _ yt-dlp --downloader aria2c _
}
# info_json VIDEO_FILE
# Extract info.json from video file
function info_json() {
mkvextract -q attachments "$1" "1:/proc/self/fd/1"
}
# info_json_url VIDEO_FILE
# Get URL from info.json
function info_json_url() {
info_json "$1" | jq -r .webpage_url
}
# info_json_title VIDEO_FILE
# Get Title from info.json
function info_json_title() {
info_json "$1" | jq -r .title
}
# info_json_desc VIDEO_FILE
# Get description from info.json
function info_json_desc() {
info_json "$1" | jq -r .description
}
# info_json_uploader VIDEO_FILE
# Get uploader from info.json
function info_json_uploader() {
info_json "$1" | jq -r .uploader
}
# info_json_uploader_url VIDEO_FILE
# Get uploader URL from info.json
function info_json_uploader_url() {
info_json "$1" | jq -r .uploader_url
}
# info_json_upload_date VIDEO_FILE
# Get upload date from info.json
function info_json_upload_date() {
info_json "$1" | jq -r .upload_date
}