Advertisement
Quantumzblue

Untitled

Sep 30th, 2019
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.22 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.   my $IDchamp;
  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 (@NameSkin,
  36.       $picURL,
  37.       $id,
  38.       $skinPrice
  39.         );
  40.           my  $skinName =   'champion/skins/portrait/(.*.jpg)';
  41.           $skinPrice = 'cost">(\d+)';
  42.           my @skin_Name = ($htmlpage =~ m/$skinName/g);
  43.           my @price_skin = ($htmlpage =~ m/$skinPrice/g);
  44.  
  45.             for (my $i = 0; $i<scalar(@price_skin);$i++) {
  46.             @NameSkin = split('.', $skin_Name[$i]);
  47.             print "$NameSkin[0] RP: $price_skin[$i] \n";
  48.             my $url_imgSkin = 'https://www.mobafire.com/images/champion/skins/portrait/'.$skin_Name[$i];
  49.             print $url_imgSkin."\n";
  50.             my $loadSkin;
  51.             $loadSkin = getstore($url_imgSkin, $IDchamp.'/'.$skin_Name[$i]);
  52.             if ($loadSkin == 200) {
  53.               print "Downloaded $NameSkin[0] \n";
  54.               open (DUMP,'>>'.'ahtml') or die ("[!]The file for dump cannot be create \n");
  55.               {
  56.               print DUMP "$NameSkin[0] RP: $price_skin[$i] \n";;
  57.               close(DUMP);
  58.               }
  59.             }
  60.             else{
  61.               print "Something wrong \n";
  62.             }
  63.           }
  64.  
  65.  
  66.  
  67. }
  68.  
  69.  
  70.  
  71. #============================================================================== start ============================================================
  72.  
  73. startBrowser();
  74. for ($IDchamp =1; $IDchamp < 150; $IDchamp++) {
  75. my $link = 'https://www.mobafire.com/league-of-legends/skins?sort_type=price&sort_order=desc&champion_id='.$IDchamp.'&skin_name=&skin_type=&is_available=1&on_sale=&is_new=';
  76. system("mkdir $IDchamp");
  77. $htmlpage = getURL($link);
  78. getInfo();
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement