download youtube with bash

Who doesn’t know what youtube.com is. You can found any favorites music clips and video there. More than that, you can use youtube.com as your media to share your home-made video there. You can download that too, incase you want to watch your friend video and backup that to your own PC.

Here little bash script to show you how to that. You need ffmpeg if you want convert the video to mpeg format.

#!/bin/bash
# Command: sh convert filename youtubeurl
# Note: don’t use space for filename

url_asli=$2
url_baru=”http://youtube.com/get_video.php?”;
nama_baru=$1

wget $url_asli -O /tmp/$nama_baru;
temporary_file=$url_baru`grep player2.swf /tmp/$nama_baru | cut -d? -f2 | cut -d\” -f1`;

wget “$temporary_file” -O /tmp/$nama_baru.flv

# Remove ‘#’ below if you want to convert it to mpg
# ffmpeg -i /tmp/$nama_baru.flv -y -sameq $nama_baru.mpg;
# rm /tmp/$nama_baru.flv;
# rm /tmp/$nama_baru;

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s