changeset 148:b23077d597b0

fixed.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sat, 01 Nov 2008 01:34:39 +0800
parents 7f9109a50679 (diff) aad08889ddb3 (current diff)
children 97dfcc0d1e3f
files Ikariam.pm
diffstat 1 files changed, 4 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/Ikariam.pm	Fri Oct 31 18:01:21 2008 +0800
+++ b/Ikariam.pm	Sat Nov 01 01:34:39 2008 +0800
@@ -95,7 +95,6 @@
 use LWP;
 use HTTP::Cookies;
 use WWW::Mechanize;
-use HTML::TagParser;
 use XML::LibXML qw(:encoding);
 use IO::Uncompress::Gunzip qw(gunzip $GunzipError) ;
 use POSIX;
@@ -578,14 +577,10 @@
     $report{defender} = $extractor->find('//div[@id="troopsReport"]//table[@id="result"]//th[@class="defenders"]');
     $report{winner} = $extractor->find('//div[@id="troopsReport"]//table[@id="result"]//td[@class="winner"]');
 
-    my $href;
-    if($self->{server} ne "s4.ikariam.tw") {
-        $report{targetCity} = $extractor->find('//div[@id="troopsReport"]/div/h3/a/text()');
-        $href = $extractor->find('//div[@id="troopsReport"]/div/h3/a/@href');
-    } else {
-        $report{targetCity} = $extractor->find('//td[@class="battle"]/a/text()');
-        $href = $extractor->find('//td[@class="battle"]/a/@href');
-    }
+    $report{targetCity} = $extractor->find('//div[@id="troopsReport"]/div/h3/a/text()');
+    my $href = $extractor->find('//div[@id="troopsReport"]/div/h3/a/@href');
+    # $report{targetCity} = $extractor->find('//td[@class="battle"]/a/text()');
+    # my $href = $extractor->find('//td[@class="battle"]/a/@href');
 
     if($href =~ /index\.php\?view=island&id=(\d+)&selectCity=(\d+)/) {
        $report{island} = $1;
@@ -918,43 +913,5 @@
     }
 }
 
-sub getElementsByTagName {
-    my $element = shift;
-    my $tagname = lc(shift);
-    my ( $flat, $cur ) = @$element;
-
-    my $out = [];
-    for( ; $cur <= $#$flat ; $cur++ ) {
-        last if ($flat->[ $cur + 1 ]->[001] eq $element->tagName() );
-        next if ($flat->[$cur]->[001] ne $tagname );
-        next if $flat->[$cur]->[000]; # close
-
-        my $elem = HTML::TagParser::Element->new( $flat, $cur );
-        return $elem unless wantarray;
-        push( @$out, $elem );
-    }
-    return unless wantarray;
-    @$out;
-}
-
-sub getElementsByAttribute {
-    my $element = shift;
-    my $key  = lc(shift);
-    my $val  = shift;
-    my ( $flat, $cur ) = @$element;
-
-    my $out  = [];
-    for ( ; $cur <= $#$flat ; $cur++ ) {
-        next if $flat->[$cur]->[000];    # close
-        my $elem = HTML::TagParser::Element->new( $flat, $cur );
-        my $attr = $elem->attributes();
-        next unless exists $attr->{$key};
-        next if ( $attr->{$key} ne $val );
-        return $elem unless wantarray;
-        push( @$out, $elem );
-    }
-    return unless wantarray;
-    @$out;
-}
 
 1;