X-Git-Url: http://dolda2000.com/gitweb/?p=utils.git;a=blobdiff_plain;f=ANN.pm;h=6dd02e94fc951f0b1773cf7f5131f6ecf3359386;hp=48bd9c494c6539071e19f4bb1aab2dc14ece7c21;hb=8b09dc89e6081cfc76fee513be8dac9e39b6305f;hpb=553e41ef5bc95f5edcce12ccf15beae3d0fdaddc diff --git a/ANN.pm b/ANN.pm index 48bd9c4..6dd02e9 100644 --- a/ANN.pm +++ b/ANN.pm @@ -35,12 +35,12 @@ sub _get $res = $ua->request(HTTP::Request->new("GET", "$uri")); if(open CACHE, ">:utf8", $cname) { - print CACHE $res->content; + print CACHE $res->decoded_content; close CACHE; } return undef unless $res->is_success; - return $res->content; + return $res->decoded_content; } sub getlist @@ -58,9 +58,9 @@ sub getlist # The only way to recognize entries that seems sure is to look # after the "HOVERLINE" class. - while($html =~ /(\.*\<\/small\>)?([^<]+)<\//ig) { - if((substr "" . lc $3 , 0, length $name) eq lc $name) { - push @ret, $3; + while($html =~ /]*>(]*>)?([^<]*<\/small>)?\s*([^<]+)<\//ig) { + if((substr "" . lc $4 , 0, length $name) eq lc $name) { + push @ret, $4; } } # push @ret, $1 while $html =~ /.*([^<>]*$name[^<>]*)<\/FONT/ig; @@ -83,8 +83,8 @@ sub getid # The only way to recognize entries that seems sure is to look # after the "HOVERLINE" class. - while($html =~ /(\.*\<\/small\>)?([^<]+)<\//ig) { - if((substr "" . lc $3 , 0, length $name) eq lc $name) { + while($html =~ /]*>(]*>)?([^<]*<\/small>)?\s*([^<]+)<\//ig) { + if((substr "" . lc $4 , 0, length $name) eq lc $name) { return ($1 =~ /id=(\d+)$/)[0]; } }