curaga
Group: Members
Posts: 2163
Joined: Feb. 2007 |
|
Posted: Sep. 18 2007,18:37 |
|
Okay, Youtube changed their video downloading possibilities, in an attempt to prevent downloading their videos. So here's a new ver that can still download
Quote | #!/bin/bash # Script for downloading Youtube videos. Base was from nixcraft.org # Edited by Curaga for my liking (Added ability for nearly unlimited URLs, help, # comments, and ability to get urls from args)
case $1 in -h | *help ) echo "Usage: ${0##*/} url1 url2.. or just ${0##*/} and type the urls" exit 0 ;; esac
ripurl="http://youtube.com/get_video.php?" tmp=`mktemp` touch $tmp.flv mkdir -p ~/YouTube;cd ~/YouTube url="not empty in da beginning"
until [ -z "$url" ]; do if [ -n "$1" ] && [[ $1 = http://* ]]; then url=$1 elif [ -n "$1" ]; then echo "Not a valid url. http:// required."; exit 1; fi
if [ -z "$1" ]; then read -p "YouTube URL? Press enter to exit. " url; fi if [ -z "$url" ]; then rm $tmp clear; echo -e "\n Finished." exit 0; fi
echo echo ------------------------------------------------------------------------ echo -e " Now getting the page for analysis.\n" wget -nv "$url" -O $tmp
uf=$ripurl`grep watch_fullscreen $tmp | sed "s;.*\(video_id.\+\)&title.*;\1;"`
nv=`grep 'h1 id="video_title"' $tmp | cut -d ">" -f 2 | cut -d "<" -f 1`
echo -e "\n\n Title: $nv\n\n"
wget "$uf" -O $tmp.flv echo "" > $tmp newname=`echo $nv | sed 's;/;\/;g'` mv "$tmp.flv" "$newname.flv" echo -e "\n\n $HOME/Youtube/$newname.flv ready.\n"
shift done |
-------------- There's no such thing as life. Those mean little jocks invented it ;) - Windows is not a virus. A virus does something!
|