Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- use Data::Dumper;
- use HTTP::Cookies;
- use LWP::UserAgent;
- use LWP::Simple;
- use strict;
- $| =1;
- my $browser;
- my $htmlpage;
- my $IDchamp;
- sub startBrowser{
- $browser = LWP::UserAgent->new(
- agent=>'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/1.5.0.5',
- # cookie_jar => $cookie_jar,
- max_redirect => 0,
- timeout =>15,
- );
- }
- sub getURL{
- my $url = $_[0];
- my $resp = $browser->get($url);
- my $content = $resp->content(); #make content store web scoure
- #print $content;
- return $content;
- }
- sub getInfo{
- my (@NameSkin,
- $picURL,
- $id,
- $skinPrice
- );
- my $skinName = 'champion/skins/portrait/(.*.jpg)';
- $skinPrice = 'cost">(\d+)';
- my @skin_Name = ($htmlpage =~ m/$skinName/g);
- my @price_skin = ($htmlpage =~ m/$skinPrice/g);
- for (my $i = 0; $i<scalar(@price_skin);$i++) {
- @NameSkin = split('.', $skin_Name[$i]);
- print "$NameSkin[0] RP: $price_skin[$i] \n";
- my $url_imgSkin = 'https://www.mobafire.com/images/champion/skins/portrait/'.$skin_Name[$i];
- print $url_imgSkin."\n";
- my $loadSkin;
- $loadSkin = getstore($url_imgSkin, $IDchamp.'/'.$skin_Name[$i]);
- if ($loadSkin == 200) {
- print "Downloaded $NameSkin[0] \n";
- open (DUMP,'>>'.'ahtml') or die ("[!]The file for dump cannot be create \n");
- {
- print DUMP "$NameSkin[0] RP: $price_skin[$i] \n";;
- close(DUMP);
- }
- }
- else{
- print "Something wrong \n";
- }
- }
- }
- #============================================================================== start ============================================================
- startBrowser();
- for ($IDchamp =1; $IDchamp < 150; $IDchamp++) {
- 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=';
- system("mkdir $IDchamp");
- $htmlpage = getURL($link);
- getInfo();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement