Difference between revisions of "Script untuk Download Youtube ke .avi"

From OnnoWiki
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 7: Line 7:
  
 
  #!/bin/sh
 
  #!/bin/sh
 
+
 
  # YouTube Videodownloader for those of us,  
 
  # YouTube Videodownloader for those of us,  
 
  # who has no sucking Flash in their browsers.
 
  # who has no sucking Flash in their browsers.
Line 14: Line 14:
 
  #
 
  #
 
  # $Id: hacktube.sh,v 0.1.0.9 2007/04/29 00:45:51 ivap Exp $
 
  # $Id: hacktube.sh,v 0.1.0.9 2007/04/29 00:45:51 ivap Exp $
 
+
 
  if [ $# -lt 1 ]; then
 
  if [ $# -lt 1 ]; then
 
     echo -e 1>&2 "Usage: $0 [-f] <url or id>"
 
     echo -e 1>&2 "Usage: $0 [-f] <url or id>"
Line 23: Line 23:
 
     exit 64
 
     exit 64
 
  fi
 
  fi
 
+
 
  while [ $# -ge 1 ]; do
 
  while [ $# -ge 1 ]; do
 
             case "$1" in
 
             case "$1" in
Line 42: Line 42:
 
             shift
 
             shift
 
  done
 
  done
 
+
 
  if ! `which wget >/dev/null 2>&1`; then
 
  if ! `which wget >/dev/null 2>&1`; then
 
     echo 1>&2 "ERROR: Install wget and try again"
 
     echo 1>&2 "ERROR: Install wget and try again"
 
     exit 69
 
     exit 69
 
  fi
 
  fi
 
+
 
  f_id=`echo $vid_url | sed 's/.*=//1'`
 
  f_id=`echo $vid_url | sed 's/.*=//1'`
 
  base_url='http://www.youtube.com/get_video?'
 
  base_url='http://www.youtube.com/get_video?'
Line 55: Line 55:
 
     exit 69
 
     exit 69
 
  fi
 
  fi
 
+
 
  if ! wget -q -O $temp_fname $vid_url; then
 
  if ! wget -q -O $temp_fname $vid_url; then
 
     echo "ERROR: could not retrieve requested page"
 
     echo "ERROR: could not retrieve requested page"
Line 61: Line 61:
 
     exit 69
 
     exit 69
 
  fi  
 
  fi  
 
+
 
  new_url=`cat $temp_fname | grep player2.swf | sed 's/va.*?//1' | sed 's/".*;//g'`
 
  new_url=`cat $temp_fname | grep player2.swf | sed 's/va.*?//1' | sed 's/".*;//g'`
 
  complete=`echo $base_url $new_url| sed 's/ //1'`
 
  complete=`echo $base_url $new_url| sed 's/ //1'`
 
  rm $temp_fname
 
  rm $temp_fname
 
+
 
  if ! wget -O ${f_id}.flv $complete; then
 
  if ! wget -O ${f_id}.flv $complete; then
 
     echo "ERROR: could not retrieve requested video"
 
     echo "ERROR: could not retrieve requested video"
 
     exit 69
 
     exit 69
 
  fi
 
  fi
 
+
 
  #feel free to tune ffmpeg's flags
 
  #feel free to tune ffmpeg's flags
 
  if [ -n "$with_ffmpeg" ]; then  
 
  if [ -n "$with_ffmpeg" ]; then  
Line 95: Line 95:
 
==Referensi==
 
==Referensi==
  
 +
* http://tips.webdesign10.com/youtube-downloader-linux
 
* http://wonkmlarat.blogspot.com/2010/04/youtube-downloader-cara-cepat-download.html
 
* http://wonkmlarat.blogspot.com/2010/04/youtube-downloader-cara-cepat-download.html
 
* http://ubuntuforums.org/showthread.php?p=1656936
 
* http://ubuntuforums.org/showthread.php?p=1656936
Line 102: Line 103:
  
 
* [[Multimedia di Linux]]
 
* [[Multimedia di Linux]]
* [[Linux Howto]]
+
* [[Tip Internet]]
 +
* [[Script untuk Download Youtube ke .avi]]
 +
* [[Youtube Downloader, Cara Cepat Download Film Dari Youtube]]
 +
* [[Download Youtube di Ubuntu 10.04]]
 +
* [[Download youtube ke .flv]]
 +
* [[Script untuk mencuri file youtube di /tmp]]
  
 
[[Category: Multimedia]]
 
[[Category: Multimedia]]
 
[[Category: Linux]]
 
[[Category: Linux]]
 
[[Category: Internet]]
 
[[Category: Internet]]

Latest revision as of 19:21, 20 March 2012

Edit file misalnya

$ vi hacktube.sh


Masukan script berikut

#!/bin/sh

# YouTube Videodownloader for those of us, 
# who has no sucking Flash in their browsers.
# If you experience any problems with this script, please
# report them to ivap on SILCNet (https://silcnet.org)
#
# $Id: hacktube.sh,v 0.1.0.9 2007/04/29 00:45:51 ivap Exp $

if [ $# -lt 1 ]; then
   echo -e 1>&2 "Usage: $0 [-f] <url or id>"
   echo -e 1>&2 "Options:\n\t-f   enable ffmpeg postprocessing"
   echo -e 1>&2 "Examples: "
   echo -e 1>&2 "\t$0 http://www.youtube.com/watch?v=injqufD1WZI"
   echo -e 1>&2 "\t$0 injqufD1WZI"
   exit 64
fi

while [ $# -ge 1 ]; do
            case "$1" in
             "-f")
                if ! `which ffmpeg >/dev/null 2>&1`; then
                   echo 1>&2 "ERROR: Install ffmpeg and try again"
                   exit 69
                fi
                with_ffmpeg="true"              
                ;;
             *youtube*)
                vid_url=$1
                ;;
             *)
                vid_url=`echo http://www.youtube.com/watch?v= $1 | sed 's/ //g'`
                ;;
            esac
            shift
done

if ! `which wget >/dev/null 2>&1`; then
   echo 1>&2 "ERROR: Install wget and try again"
   exit 69
fi

f_id=`echo $vid_url | sed 's/.*=//1'`
base_url='http://www.youtube.com/get_video?'
temp_fname=`mktemp html_data.XXXXXX`
if [ $? -ne 0 ]; then
   echo "ERROR: cannot create temp file"
   exit 69
fi

if ! wget -q -O $temp_fname $vid_url; then
   echo "ERROR: could not retrieve requested page"
   rm $temp_fname
   exit 69
fi 

new_url=`cat $temp_fname | grep player2.swf | sed 's/va.*?//1' | sed 's/".*;//g'`
complete=`echo $base_url $new_url| sed 's/ //1'`
rm $temp_fname

if ! wget -O ${f_id}.flv $complete; then
    echo "ERROR: could not retrieve requested video"
    exit 69
fi

#feel free to tune ffmpeg's flags
if [ -n "$with_ffmpeg" ]; then 
   if ffmpeg -acodec mp3 -i ${f_id}.flv ${f_id}.avi; then
         rm ${f_id}.flv
         exit 0
   else
      echo "ERROR: could not convert video"
      rm -f ${f_id}.avi
      exit 69
   fi
fi


Ubah permission

$ chmod +x hacktube.sh

Jalankan

$ ./hacktube.sh http://youtube.com/url.... 


Referensi

Pranala Menarik