Created
January 20, 2020 19:38
-
-
Save ingridstevens/33fb1f89e0b5f1cb236d5ffe3375dcfe 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 | |
# converts and saves youtube video to mp3 | |
function convert_to_mp3() { | |
#ensure the video is downloaded to the correct location (youtube folder in Downloads) | |
if [ -d "~/Downloads/youtube" ]; then | |
cd ~/Downloads/youtube | |
else | |
# if there is no youtube folder in Downloads, make one | |
mkdir ~/Downloads/youtube | |
cd ~/Downloads/youtube | |
fi | |
#download youtube audio into the folder ~/Downloads/youtube | |
youtube-dl --extract-audio --audio-format mp3 $1 | |
} | |
#prints a kitty!! | |
function kitty() { | |
echo ' | |
|\__/,| (`\ | |
_.|o o |_ ) ) | |
-(((---(((--------' | |
} | |
#print a bird | |
function bird() { | |
echo " | |
__ | |
( o> | |
///\ | |
\V_/_ | |
" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This shell script includes a function which enables you to save the audio from a youtube video on to your computer.
To run, you first need to source the file, which can be done from any directory so long as
~
is used before the file path:$ source ~/.youtube_downloader.sh
Then to run the youtube converter (which can be done from any directory after sourcing), run it (with any youtube URL):
$ convert_to_mp3 https://www.youtube.com/watch?v=B7UmUX68KtE
Then look for the file in
~/Downloads/youtube
You can also run
$ kitty
to print a friendly kittyor run
$ bird
to put a bird on itand if you want a kitty looking at a bird, run
$ bird && kitty