Advertisement
Quantumzblue

dump skins

Sep 23rd, 2019
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.88 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2. use Data::Dumper;
  3. use HTTP::Cookies;
  4. use LWP::UserAgent;
  5. use LWP::Simple;
  6. use strict;
  7. $| =1;
  8.   my $browser;
  9.   my $htmlpage;
  10.  
  11. sub startBrowser{
  12.  
  13.    $browser = LWP::UserAgent->new(
  14.       agent=>'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/1.5.0.5',
  15.     #  cookie_jar => $cookie_jar,
  16.       max_redirect => 0,
  17.       timeout =>15,
  18.                                     );
  19. }
  20.  
  21. sub getURL{
  22.  
  23.   my $url = $_[0];
  24.   my $resp = $browser->get($url);
  25.   my $content = $resp->content(); #make content store web scoure
  26.     #print $content;
  27.   return $content;
  28. }
  29.  
  30.  
  31.  
  32.  
  33.  
  34. sub getInfo{
  35.   my ($champ,
  36.       $skinName,
  37.       $imgURL,
  38.       $skinPrice
  39.         );
  40.         $imgURL =   'cost">(\d+)';
  41.         $skinName  = '<div class="champ-skins__item__meta">\s+.*>([\w.\s].*)<';
  42.         $skinPrice = 'cost">(\d+)';
  43.  
  44.              $champ = ($htmlpage =~ /name="champion" value\=\"(\w+)"/g);
  45.           my @price_skin = ($htmlpage =~ m/$skinName/g);
  46.           my @img_skin   = ($htmlpage =~ m/$imgURL/g);
  47.           my @Name_skin  = ($htmlpage =~ m/$skinName/g);
  48.  
  49.  
  50.  
  51.                   for (my $i = 0; $i < scalar(@price_skin); $i++) {
  52.  
  53.                   my $rc = getstore($img_skin[$_], "$Name_skin[$_]".'.jpg');
  54.                   if($rc == 200)     {
  55.  
  56.                     print $Name_skin[$i].": RP $price_skin[$i] Downloaded \n";
  57.                                   }
  58.  
  59.                   else            {
  60.                     print "some error \n";
  61.                                   }
  62.                                                                   }
  63.  
  64.  
  65.  
  66. }
  67.  
  68.  
  69.  
  70. #============================================================================== start ============================================================
  71.  
  72. startBrowser();
  73. print "Link: ";
  74. chop (my $link = <stdin>);
  75. $htmlpage = getURL($link);
  76. #$htmlpage = getURL('');
  77. getInfo();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement