SHOW:
|
|
- or go back to the newest paste.
| 1 | #!/bin/bash | |
| 2 | # Youtube to MP3 Bash Script | |
| 3 | ||
| 4 | # CPR : Jd Daniel :: Ehime-ken | |
| 5 | # MOD : 2013-25-06 @ 10:45:38 | |
| 6 | ||
| 7 | # Ubuntu | |
| 8 | # REQ : sudo apt-get install youtube-dl && youtube-dl -U | |
| 9 | # REQ : sudo apt-get install lame | |
| 10 | # REQ : ./getffmpegproper || ffmpeg [use: http://pastebin.com/iYGwzQGw] | |
| 11 | ||
| 12 | - | video_id=${BASH_REMATCH[1]}
|
| 12 | + | |
| 13 | - | video_id=$(echo $video_id | cut -d'&' -f1) |
| 13 | + | # Fedora (18) / Arch |
| 14 | - | video_title="$(youtube-dl --get-title $address)" |
| 14 | + | # REQ : sudo yum -y install youtube-dl && sudo youtube-dl -U |
| 15 | - | youtube-dl -o "$video_title".flv $address |
| 15 | + | # REQ : sudo yum -y install lame |
| 16 | - | ffmpeg -i "$video_title".flv -acodec libmp3lame -ac 2 -ab 256k -vn -y "$video_title".mp3 |
| 16 | + | # REQ : su -c "curl http://download.opensuse.org/repositories/home:/satya164:/fedorautils/Fedora_18/home:satya164:fedorautils.repo -o /etc/yum.repos.d/fedorautils.repo && yum install fedorautils" |
| 17 | - | mv "$video_title".mp3 ~/Music |
| 17 | + | # REQ : su -c 'yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-18.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-18.noarch.rpm' |
| 18 | - | rm "$video_title".flv |
| 18 | + | # REQ : sudo yum -y install gstreamer gstreamer-ffmpeg gstreamer-plugins-bad gstreamer-plugins-bad-free gstreamer-plugins-bad-nonfree gstreamer-plugins-base gstreamer-plugins-good gstreamer-plugins-ugly ffmpeg yasm yasm-devel |
| 19 | ||
| 20 | - | echo "Sorry but you seemed to broken the interwebs." |
| 20 | + | |
| 21 | address=$1 | |
| 22 | regex='v=(.*)' | |
| 23 | if [[ $address =~ $regex ]]; then | |
| 24 | video_id=${BASH_REMATCH[1]}
| |
| 25 | video_id=$(echo $video_id | cut -d'&' -f1) | |
| 26 | video_title="$(youtube-dl --get-title $address)" | |
| 27 | youtube-dl -o "$video_title".flv $address | |
| 28 | ffmpeg -i "$video_title".flv -acodec libmp3lame -ac 2 -ab 256k -vn -y "$video_title".mp3 | |
| 29 | mv "$video_title".mp3 ~/Music | |
| 30 | rm "$video_title".flv | |
| 31 | else | |
| 32 | echo "Sorry but you seemed to broken the interwebs." | |
| 33 | fi |