X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=ANN.pm;h=1406c4584045c8f4d636875d9ac481aa7166f38e;hb=3e60094e9bdf9494bcddb4ebc036e39ae5d9b5ce;hp=aefd04efca61573395bb688e492644f6f00f531e;hpb=edeeab7e12944f6a0935f4c27108032f0b8ec0e0;p=utils.git diff --git a/ANN.pm b/ANN.pm index aefd04e..1406c45 100644 --- a/ANN.pm +++ b/ANN.pm @@ -57,7 +57,12 @@ sub getlist # The only way to recognize entries that seems sure is to look # after the "HOVERLINE" class. - push @ret, $1 while $html =~ /.*([^<>]*$name[^<>]*)<\/FONT/ig; + while($html =~ /([^<]+)<\//ig) { + if((substr "" . lc $2 , 0, length $name) eq lc $name) { + push @ret, $2; + } + } + # push @ret, $1 while $html =~ /.*([^<>]*$name[^<>]*)<\/FONT/ig; return @ret; } @@ -76,9 +81,13 @@ sub getid # The only way to recognize entries that seems sure is to look # after the "HOVERLINE" class. - (($url) = ($html =~ /([^<]+)<\//ig) { + if((substr "" . lc $2 , 0, length $name) eq lc $name) { + return ($1 =~ /id=(\d+)$/)[0]; + } + } - return ($url =~ /\?id=(\d+)$/)[0]; + return undef; } sub geturl @@ -98,8 +107,8 @@ sub getthemes my(@parts, $ct, $buf); while($html =~ /\G\    (([^<>]|\|<\/i>)+)/igc) { $buf = $1; - # 0 1 2 3 4 5 6 7 8 9 10 11 - if(@parts = ($buf =~ /(\#(\d+):)?\s*\"([^\"\(]+)(\s+\((\(.*)<\/i>(;\s*)?)?([^<>]+)?\))?\"\s+by\s+([^\(]*[^\(\s])(\s*\(eps (\d+)-(\d+)?\))?/i)) { + # 0 1 2 3 4 5 6 7 8 9 10 11 + if(@parts = ($buf =~ /(\#(\d+):)?\s*\"([^\"\(]+\S)(\s*\((\(.*)<\/i>(;\s*)?)?([^<>]+)?\))?\"\s+by\s+([^\(]*[^\(\s])(\s*\(eps (\d+)-(\d+)?\))?/i)) { $ct = {}; $ct->{"num"} = $parts[1] if defined $parts[1]; if(defined $parts[5]) { @@ -122,7 +131,7 @@ sub getthemes sub getseries { - my($id, $buf, $html, %ret, @cp); + my($id, $buf, $html, %ret); ($id) = @_; if(!($html = _get geturl $id)) { @@ -143,8 +152,7 @@ sub getseries $ret{"eps"} = $buf; } if(($buf) = ($html =~ /genres:<\/b>\n([^<]+)