help help help in youtube
am 22.01.2007 13:48:45 von Perlstudent
hi,
i',m the newbie in perl and i get the follow code.
it is the script for download youtube video .
i would like to know that"how to retrieve the %3a to : and %2f to / in
this script
and read this script more easy.
any one can help me, i want to get some from this regpex
"file name getyoutube.pl"
"/getyoutube.pl http://www.youtube.com/watch?v=kH8cS1AkqiI"
#!/usr/bin/perl -w
use LWP::Simple;LWP::Simple::get(shift) =~ /
YouTube -
(.*?)<\/title>.*player2.swf\?(video_id=([0-9a-z]+).+?)\"/is && exec
"wget -c -S -O $3.flv \"http://youtube.com/get_video.php?$2\" && ffmpeg
-i $3.flv -ab 56 -ar 22050 -b 500 -s 320x240
\"".(@ARGV?shift:"$1.mpg")."\" && echo && echo YouTube:$3 saved as
\\\"$1.mpg\\\""
in case, about the ffmpeg and wget, i understood what that doing,but
in perl(rexp) i can't understand.
may be the flow...i also no 100% understand,can expand ?
thank a lot.
Re: help help help in youtube
am 22.01.2007 20:22:39 von Joe Smith
Perlstudent wrote:
> any one can help me, i want to get some from this regpex
Next time, put the subject of you posting in the Subject: of your posting.
> /
YouTube -(.*?)<\/title>.*player2.swf\?(video_id=([0-9a-z]+).+?)\"/is
The first part is obvious:
YouTube - WorldMap Live Storm-Worm
The second set of parentheses looks at
var fo = new SWFObject("/player2.swf?video_id=kH8cS1AkqiI&l=40&t=OEgsToPD skIj7q6NT71MnrRBo7WFZDnv",
and sets $2 to
video_id=kH8cS1AkqiI&l=40&t=OEgsToPDskIj7q6NT71MnrRBo7WFZDnv
and $3 to
kH8cS1AkqiI
So what part do you have trouble understanding?
() They set $1, $2, $3 on successful match.
.*? This requests the minimal match that lets the rest match.
[0-9a-z]+ Alphabetic and numeric characters only, at least one of them.
//is Treat uppercase and lowercase the same, allow /./ to match "\n".
-Joe
P.S. When posting to english newsgroups, it is better to use Character-Encoding: ISO-8859-1
instead of Character-Encoding: big5.
Re: help help help in youtube
am 23.01.2007 06:40:53 von Perlstudent
thank a lot.
Joe Smith =BCg=B9D=A1G
> Perlstudent wrote:
>
> > any one can help me, i want to get some from this regpex
>
> Next time, put the subject of you posting in the Subject: of your posting.
>
> > /
YouTube -(.*?)<\/title>.*player2.swf\?(video_id=3D([0-9a-z]+).+=
?)\"/is
>
> The first part is obvious:
> YouTube - WorldMap Live Storm-Worm
>
> The second set of parentheses looks at
> var fo =3D new SWFObject("/player2.swf?video_id=3DkH8cS1AkqiI&l=3D40&t=
=3DOEgsToPDskIj7q6NT71MnrRBo7WFZDnv",
> and sets $2 to
> video_id=3DkH8cS1AkqiI&l=3D40&t=3DOEgsToPDskIj7q6NT71MnrRBo7 WFZDnv
> and $3 to
> kH8cS1AkqiI
>
> So what part do you have trouble understanding?
> () They set $1, $2, $3 on successful match.
> .*? This requests the minimal match that lets the rest match.
> [0-9a-z]+ Alphabetic and numeric characters only, at least one of th=
em.
> //is Treat uppercase and lowercase the same, allow /./ to match=
"\n".
>
> -Joe
>
> P.S. When posting to english newsgroups, it is better to use Character-En=
coding: ISO-8859-1
> instead of Character-Encoding: big5.