Last active
July 16, 2022 20:02
-
-
Save MoatazAbdAlmageed/842cb41c550ca4b7f3fd7cc4569ed37a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Default Command | |
# https://ianmuchina.com/blog/08-ytdl/ | |
CMD="yt-dlp" | |
# Use yt-dlp if avaiable | |
command -v yt-dlp >/dev/null && | |
CMD="yt-dlp" ARGS="" | |
# Quality Options | |
Q_HD="720" | |
Q_FHD="1080" | |
Q_DEFAULT="$Q_HD" | |
# Video | |
ydl() { | |
"$CMD" "$ARGS" \ | |
--no-playlist \ | |
--embed-subs \ | |
--format "[height<=$Q_DEFAULT]" \ | |
--output "%(uploader)s/%(title)s.%(ext)s" "$@" | |
} | |
# Video (720p) | |
yhd() { | |
"$CMD" "$ARGS" \ | |
--no-playlist \ | |
--embed-subs \ | |
--format "[height<=$Q_HD]" \ | |
--output "%(uploader)s/%(title)s.%(ext)s" "$@" | |
} | |
ypl() { | |
"$CMD" "$ARGS" \ | |
--yes-playlist \ | |
--format "[height<=$Q_DEFAULT]" \ | |
--output "%(uploader)s/%(playlist)s/%(title)s.%(ext)s" "$@" | |
} | |
# Audio | |
ymp3() { | |
"$CMD" "$ARGS" \ | |
--extract-audio \ | |
--audio-format mp3 \ | |
--no-playlist \ | |
--embed-thumbnail \ | |
--format "bestaudio" \ | |
--output "$HOME/Music/%(uploader)s/%(title)s.%(ext)s" "$@" | |
} | |
# Audio Playlist | |
ypl3() { | |
"$CMD" "$ARGS" \ | |
--extract-audio \ | |
--audio-format mp3 \ | |
--yes-playlist \ | |
--embed-thumbnail \ | |
--format "bestaudio" \ | |
--output "$HOME/Music/%(uploader)s/%(playlist)s/%(title)s.%(ext)s" "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment