diff PokeScrape.pl @ 0:477258d09353 boosterpack

[svn r1] initial import
author robert
date Sun, 30 Aug 2009 02:19:26 -0400
parents
children d7dd496a4fa6
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/PokeScrape.pl	Sun Aug 30 02:19:26 2009 -0400
     1.3 @@ -0,0 +1,67 @@
     1.4 +use Card;
     1.5 +use Storable;
     1.6 +
     1.7 +open POKE, "<all.dat";
     1.8 +
     1.9 +@allcards = ();
    1.10 +
    1.11 +
    1.12 +for $line(<POKE>)
    1.13 +{
    1.14 +	$line =~ m/(<img.*?>).*?(<img.*?>).*?/;
    1.15 +	
    1.16 +	$img1 = $1;
    1.17 +	$img3 = $2;
    1.18 +	$line =~ m/(<a.*?<\/a>).*?/;
    1.19 +	$img2 = $1;
    1.20 +	
    1.21 +	
    1.22 +	#<img src="/cdexdata/images/types/w.gif" alt="Water" title="Water" height="17" width="17" class="t">
    1.23 +	
    1.24 +	#<a id="base-set-2-blastoise" href="/scans/base-set/2-blastoise.jpg" title="Blastoise from Base Set (#2)" target="1">Blastoise</a>
    1.25 +	
    1.26 +	#<img src="/cdexdata/images/rarities/rare-holo.gif" alt="Rare Holo" title="Rare Holo" width="28" height="16">
    1.27 +	
    1.28 +
    1.29 +	
    1.30 +	
    1.31 +	$img1 =~ m/alt="(.*?)"/;
    1.32 +	$typeTag = $1;
    1.33 +	
    1.34 +	$img2 =~ m/\(\#(\d+)\)/;
    1.35 +	$numTag = $1;
    1.36 +	$img2 =~ m/href="(.*?)"/;
    1.37 +	$pix = $1;
    1.38 +	$img2 =~ m/>(.*)</;
    1.39 +	$nameTag = $1;
    1.40 +	$img2 =~ m/from (.*?) \(/;
    1.41 +	$setTag = $1;
    1.42 +		
    1.43 +	$img3 =~ m/alt="(.*?)"/;
    1.44 +	$rarityTag = $1;
    1.45 +	
    1.46 +	
    1.47 +	if ($line =~ m/^<td/)
    1.48 +	{
    1.49 +		print $numTag," ",$nameTag, "\n";
    1.50 +		$tempCard = Card->new();
    1.51 +		$tempCard->addTags($typeTag,$numTag,$nameTag,$setTag,$rarityTag);
    1.52 +		$tempCard->setPix($pix);
    1.53 +		push @allcards,$tempCard;
    1.54 +		
    1.55 +		
    1.56 +	}
    1.57 +	
    1.58 +
    1.59 +	
    1.60 +}	
    1.61 +	
    1.62 +
    1.63 +store \@allcards, 'CARD.perl';
    1.64 +
    1.65 +
    1.66 +
    1.67 +my $refnewstruct = retrieve 'CARD.perl';
    1.68 +
    1.69 +
    1.70 +print @$refnewstruct[0]->getTags();
    1.71 \ No newline at end of file