Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > google and youtube script ( auto resume auto filename )

Reply
Thread Tools

google and youtube script ( auto resume auto filename )

 
 
paulwvanc@yahoo.ca
Guest
Posts: n/a
 
      12-13-2006
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

 
Reply With Quote
 
 
 
 
paulwvanc@yahoo.ca
Guest
Posts: n/a
 
      12-13-2006

Don Pearce wrote:
> On 13 Dec 2006 01:32:18 -0800, wrote:
>
> >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

>
> Alternatively use Firefox with its download plugin. It works.


What happens when you need to download 211 episodes of Naruto?

>
> d
>
> --
> Pearce Consulting
> http://www.pearce.uk.com


 
Reply With Quote
 
 
 
 
sanjian
Guest
Posts: n/a
 
      12-13-2006
wrote:
> Don Pearce wrote:
>> On 13 Dec 2006 01:32:18 -0800, wrote:
>>


>> Alternatively use Firefox with its download plugin. It works.

>
> What happens when you need to download 211 episodes of Naruto?


You get the torrents. Watching an episode or two on youtube is one thing,
but if you're going to go and do 200+, get the larger, better-quality
version.

Then buy the R1 DVDs when they come out, Sharranyao!


 
Reply With Quote
 
Scott Dorsey
Guest
Posts: n/a
 
      12-13-2006
<> wrote:
>
>What happens when you need to download 211 episodes of Naruto?


You use a for/do loop in bash to call the script. However, you should not
hold the script author for the consequent brain damage that you get from
watching all that stuff.
--scott

--
"C'est un Nagra. C'est suisse, et tres, tres precis."
 
Reply With Quote
 
Bruce Tomlin
Guest
Posts: n/a
 
      12-13-2006
In article <>,
(Don Pearce) wrote:

> Alternatively use Firefox with its download plugin. It works.


Also keepvid.com works for me.
 
Reply With Quote
 
Ansgar -59cobalt- Wiechers
Guest
Posts: n/a
 
      12-13-2006
In rec.arts.anime.misc wrote:
> 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


Ouch. This is wrong in so many ways that I can't even begin to describe
it.

----8<----
#!/bin/bash
# youtube.sh

tmpfile="$(date +%s).urlsource.txt"
baseurl="http://youtube.com/get_video.php?"

CURLOPTS="-s -S"
max_retries=3

umask 077

for url in "$@"; do
curl ${CURLOPTS} -o "${tmpfile}" "${url}"
outputfile="$(awk '/<title>/ {
gsub(".*YouTube...|<.*|", "", $0);
gsub("/", "of", $0);
gsub("[ ~()]", "_", $0);
gsub("__*", "_", $0);
print $0
}' "${tmpfile}").flv"
videoid="$(awk '/player2\.swf/ {gsub("^.*\\?|\\\".*$", "", $0); print $0}' "${tmpfile}")"
location="$(curl ${CURLOPTS} -I -L "${baseurl}${videoid}" | awk '/Location: / {sub("\r", "", $2); print $2}')"
curl ${CURLOPTS} --retry ${max_retries} -o "${outputfile}" "${location}"
done

rm -f "${tmpfile}"

exit 0
---->8----

The other script is even worse.

F'up2colm

cu
59cobalt
--
"My surname is Li and my personal name is Kao, and there is a slight
flaw in my character."
--Li Kao (Barry Hughart: Bridge of Birds)
 
Reply With Quote
 
S.t.A.n.L.e.E
Guest
Posts: n/a
 
      12-13-2006
Wed, 13 Dec 2006 9:36am-0000, Don Pearce <>:

>
> Alternatively use Firefox with its download plugin. It works.
>


http://vixy.net/flv_converter

Laters. =)

Stan
--
_______ ________ _______ ____ ___ ___ ______ ______
| __|__ __| _ | \ | | | | _____| _____|
|__ | | | | _ | |\ | |___| ____|| ____|
|_______| |__| |__| |__|___| \ ___|_______|______|______|
__| | ( )
/ _ | |/ LostRune+sig [at] UofR [dot] net
| ( _| | http://www.uofr.net/~lostrune/
\ ______| _______ ____ ___
/ \ / \ | _ | \ | |
/ \/ \| _ | |\ |
/___/\/\___|__| |__|___| \ ___|


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
command to download youtube videos - youtube-dl.pl AND PATH withperl scripts. jameshanley39@yahoo.co.uk Computer Information 1 11-28-2007 09:03 AM
Youtube: Can I upload an audio file to Youtube ? pokhara67 Computer Support 13 06-28-2007 02:04 PM
A clone of YouTube, but better then YouTube rishil DVD Video 1 03-27-2007 03:07 PM
Stitch rar files ( filename.part01 and filename.part02) Please help ixgor Software 1 10-15-2006 02:33 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57