Guest User

Y2M

a guest
May 24th, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.67 KB | None | 0 0
  1. #!/bin/bash
  2. # Youtube to MP3 Bash Script
  3.  
  4. # CPR : Jd Daniel :: Ehime-ken
  5. # REQ : sudo apt-get install youtube-dl && youtube-dl -U
  6. # REQ : sudo apt-get install lame
  7. # REQ : ./getffmpegproper || ffmpeg [use: http://pastebin.com/iYGwzQGw]
  8.  
  9. address=$1
  10. regex='v=(.*)'
  11. if [[ $address =~ $regex ]]; then
  12.     video_id=${BASH_REMATCH[1]}
  13.     video_id=$(echo $video_id | cut -d'&' -f1)
  14.     video_title="$(youtube-dl --get-title $address)"
  15.     youtube-dl -o "$video_title".flv $address
  16.     ffmpeg -i "$video_title".flv -acodec libmp3lame -ac 2 -ab 256k -vn -y "$video_title".mp3
  17.     mv "$video_title".mp3 ~/Music
  18.     rm "$video_title".flv
  19. else
  20.     echo "Sorry but you seemed to broken the interwebs."
  21. fi
Advertisement
Add Comment
Please, Sign In to add comment