hi
I see people asking for google and youtube video download scripts.
Here they are, with auto resume, auto filename. Great for downloading a
lot of videos.
youtube script is not entirely foolproof, since youtube servers are
flaky.
If you make improvement, please post.
Simply give a bunch of links as arguments.
USAGE:
youtube.sh 'http://www.youtube.com/watch?v=B4Ztn24AFrg'
'http://www.youtube.com/watch?v=mP91qkZFYqY'
google.sh
'http://video.google.com/videoplay?docid=-7837509539130010782'
'http://video.google.com/videoplay?docid=6855624764467039569'
#!/bin/bash -x
# youtube.sh
for arg in $@
do
rrr=`date +%s`
baseurl="http://youtube.com/get_video.php?"
wget $arg -O $rrr.urlsource.txt
fname=`grep '<title>' $rrr.urlsource.txt | sed "s/.*YouTube...//" \
| sed "s/<.*//"| sed "s/ /_/g" | sed "s/\//of/g" | sed "s/\~/_/g" \
| sed "s/(/_/g" | sed "s/)/_/g" | sed "s/__/_/g" `.flv
grep "player2.swf" $rrr.urlsource.txt > $rrr.url.info
cut -d? -f2 $rrr.url.info > $rrr.url
cut -d\" -f1 $rrr.url > $rrr.videoid
videourl=`cat $rrr.videoid`
fullurl=${baseurl}${videourl}
curl -I -L ${fullurl} > $rrr.txt
loc=`grep Location $rrr.txt | sed "s/Location: //"`
wget --read-timeout 3 -O $fname -t 0 -w 1 --waitretry=1 $loc
rm $rrr.urlsource.txt $rrr.url.info $rrr.url $rrr.videoid $rrr.txt
done
#!/bin/bash -x
# google.sh
for arg in $@
do
rrr=`date +%s`
wget $arg -O $rrr.urlsource.txt
fname=`grep '<title>' $rrr.urlsource.txt | sed "s/- Google Video.*//" |
\
sed "s/.*<title>//" | sed "s/:/_/g" | sed "s/ /_/g" | sed "s/\//of/g"
| \
sed "s/\~/_/g" | sed "s/(/_/g" | sed "s/)/_/g" | sed "s/__/_/g" | \
sed "s/__/_/g" `.avi
fname=`perl -e "use
HTML::Entities;print(decode_entities(\"$fname\")); "`
url="url="`perl -e "use CGI;print CGI::escape(\"$arg\");"`"&site=aa"
len=$(( `echo $url|wc -m` - 1 ))
curl
http://s1947.gridserver.com/keepvid.php -d $url > $rrr.txt
loc=`cat $rrr.txt |grep 'avi - High Quality'|sed "s/.avi - High
Quality.*//" \
| sed "s/.*<a href=\"//" | sed "s/\".*//" | sed "s/amp;//g"`
rm $rrr.txt $rrr.urlsource.txt
wget --read-timeout 3 -O $fname -t 0 -w 1 --waitretry=1 $loc
done