sornram9254

Youtube

Jun 30th, 2013
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.47 KB | None | 0 0
  1. #!/usr/bin/perl
  2. #http://www.sornram9254.com
  3. #http://facebook.com/sornram9254
  4. #http://facebook.com/sornram9254Fan
  5. use CGI qw(:standard);
  6. print "Content-type:text/html\n\n";
  7. print "<meta charset=\"utf-8\">";
  8. print "
  9. <style>
  10.     *{
  11.         text-align:center;
  12.     }
  13.     body{
  14.         background: #000;
  15.     }
  16.     p{
  17.         color: #fff;
  18.         font-size: 28px;
  19.     }
  20. </style>
  21. ";
  22. print "<form method=post>";
  23. print "<p>Youtube Link <input type=text name=InputURL size=35/></p>";
  24. print "</form>";
  25. my $url = param('InputURL');
  26. $url =~ s/https/http/g;
  27. if($url){
  28.     my $html = `wget -Ncq "$url" -O-`;
  29.     $html =~ m/<title>(.*?)<\/title>/;
  30.     $title = $1;
  31.     $title =~ s/ - YouTube//g;
  32.     my ($download) = $html =~ /"url_encoded_fmt_stream_map"([\s\S]+?)\,/ig;
  33.     $download =~ s/\:\ \"//;
  34.     $download =~ s/%3A/:/g;
  35.     $download =~ s/%2F/\//g;
  36.     $download =~ s/%3F/\?/g;
  37.     $download =~ s/%3D/\=/g;
  38.     $download =~ s/%252C/%2C/g;
  39.     $download =~ s/%26/\&/g;
  40.     $download =~ s/sig=/signature=/g;
  41.     $download =~ s/\\u0026/\&/g;
  42.     $download =~ s/(type=[^&]+)//g;
  43.     $download =~ s/(fallback_host=[^&]+)//g;
  44.     $download =~ s/(quality=[^&]+)//g;
  45.     my ($signature) = $download =~ /(signature=[^&]+)/;
  46.     my ($youtubeurl) = $download =~ /(http.+)/;
  47.     $youtubeurl =~ s/&signature.+$//;
  48.     $download = "$youtubeurl\&$signature";
  49.     $download =~ s/&+/&/g;
  50.     $download =~ s/&itag=\d+&signature=/&signature=/g;
  51.     print "<p>$title</p>";
  52.     print "<video poster=\"../vdo.png\" width=\"640\" height=\"480\" src=\"$download\" controls=\"controls\"></video>";
  53. }
Advertisement
Add Comment
Please, Sign In to add comment