Created
April 24, 2015 13:08
-
-
Save franklinjavier/305a5cd46100c1fcb589 to your computer and use it in GitHub Desktop.
A very simple Bash script to download a YouTube video and extract the music file from it.
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/bash | |
| address=$1 | |
| regex='v=(.*)' | |
| if [[ $address =~ $regex ]]; then | |
| video_id=${BASH_REMATCH[1]} | |
| video_id=$(echo $video_id | cut -d'&' -f1) | |
| video_title="$(youtube-dl --get-title $address)" | |
| youtube-dl $address | |
| echo "Starting FFMPEG for: " $video_id " *********\n\n\n\n\n" | |
| ffmpeg -i $video_id.flv "$video_title".wav | |
| echo "Starting LAME &&&&&&&&&\n\n\n\n\n" | |
| lame "$video_title".wav "$video_title".mp3 | |
| rm $video_id.$ext "$video_title".wav | |
| else | |
| echo "Sorry but the system encountered a problem." | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment