Created
January 28, 2021 15:57
-
-
Save ryuichi24/b76a19ea46e0cd851f32e390c0619da9 to your computer and use it in GitHub Desktop.
wrapper commands for youtube-dl
This file contains hidden or 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/zsh | |
| ydDir="$HOME/yd" | |
| videoDir="$HOME/yd/videos" | |
| musicDir="$HOME/yd/music" | |
| # make yd directories if not exist | |
| if [ ! -d "$ydDir" ]; then | |
| mkdir "$HOME/yd" | |
| mkdir "$videoDir" | |
| mkdir "$musicDir" | |
| fi | |
| function getmusic() { | |
| musicUrl=$1 | |
| if [ -z $musicUrl ]; then | |
| echo "please provide an url to the music" | |
| else | |
| youtube-dl -o "$musicDir/%(title)s.%(ext)s" --extract-audio --audio-format mp3 $musicUrl | |
| fi | |
| } | |
| function getvideo() { | |
| videoUrl=$1 | |
| if [ -z $videoUrl ]; then | |
| echo "please provide an url to the video" | |
| else | |
| youtube-dl -o "$videoDir/%(title)s.%(ext)s" -f 18 $videoUrl | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment