view 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 source
1 use Card;
2 use Storable;
4 open POKE, "<all.dat";
6 @allcards = ();
9 for $line(<POKE>)
10 {
11 $line =~ m/(<img.*?>).*?(<img.*?>).*?/;
13 $img1 = $1;
14 $img3 = $2;
15 $line =~ m/(<a.*?<\/a>).*?/;
16 $img2 = $1;
19 #<img src="/cdexdata/images/types/w.gif" alt="Water" title="Water" height="17" width="17" class="t">
21 #<a id="base-set-2-blastoise" href="/scans/base-set/2-blastoise.jpg" title="Blastoise from Base Set (#2)" target="1">Blastoise</a>
23 #<img src="/cdexdata/images/rarities/rare-holo.gif" alt="Rare Holo" title="Rare Holo" width="28" height="16">
28 $img1 =~ m/alt="(.*?)"/;
29 $typeTag = $1;
31 $img2 =~ m/\(\#(\d+)\)/;
32 $numTag = $1;
33 $img2 =~ m/href="(.*?)"/;
34 $pix = $1;
35 $img2 =~ m/>(.*)</;
36 $nameTag = $1;
37 $img2 =~ m/from (.*?) \(/;
38 $setTag = $1;
40 $img3 =~ m/alt="(.*?)"/;
41 $rarityTag = $1;
44 if ($line =~ m/^<td/)
45 {
46 print $numTag," ",$nameTag, "\n";
47 $tempCard = Card->new();
48 $tempCard->addTags($typeTag,$numTag,$nameTag,$setTag,$rarityTag);
49 $tempCard->setPix($pix);
50 push @allcards,$tempCard;
53 }
57 }
60 store \@allcards, 'CARD.perl';
64 my $refnewstruct = retrieve 'CARD.perl';
67 print @$refnewstruct[0]->getTags();