Guest User

youtube download

a guest
Oct 24th, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.03 KB | None | 0 0
  1. #!/usr/bin/perl
  2. # YOU MUST INSTALL "WWW::YouTube::Download" FIRST
  3.  
  4. # HOW TO INSTALL "WWW::YouTube::Download"
  5. # [win32] (active perl)
  6. # start>run
  7. # ppm install WWW::YouTube::Download
  8.  
  9. # [NIX]
  10. # sudo cpan
  11. # install WWW::YouTube::Download
  12.  
  13. use HTTP::Cookies;
  14. use LWP::UserAgent;
  15. use WWW::YouTube::Download;
  16.  
  17. my $client = WWW::YouTube::Download->new;
  18. my $cookie_jar = HTTP::Cookies->new(autosave =>1, hide_cookie2=>1);
  19. my $browser = LWP::UserAgent->new(
  20.   agent=>'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36',
  21.   timeout=>8,
  22.   max_redirect=>0,
  23.   cookie_jar=>$cookie_jar
  24. );
  25. my $video_id = $ARGV[0];
  26. if(!$video_id){
  27.   print "[+] Input Youtube Link : ";
  28.   chomp($video_id=<stdin>);
  29. }
  30. $video_id =~s/.*youtu((\.be\/)|(be\.com\/watch\?v=))([^\&\s]+).*/$4/;
  31. my $suffix = $client->get_suffix($video_id);
  32. my $you_down = $browser->get("http://tinyurl.com/api-create.php?url=".$client->get_video_url($video_id))->content;
  33. print "[+] VDO_ID $video_id\n";
  34. print "[+] ($suffix) $you_down\n";
  35. <stdin>;
Add Comment
Please, Sign In to add comment