From: fredrik Date: Sun, 7 Aug 2005 23:07:03 +0000 (+0000) Subject: Added geturl. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=a9da636652aa8af2facfa24e56c68c19599e60bf;p=utils.git Added geturl. Decode more entities. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@306 959494ce-11ee-0310-bf91-de5d638817bd --- diff --git a/ANN.pm b/ANN.pm index 90bd24a..2ae48cd 100644 --- a/ANN.pm +++ b/ANN.pm @@ -53,6 +53,14 @@ sub getid return ($url =~ /\?id=(\d+)$/)[0]; } +sub geturl +{ + my($id); + ($id) = @_; + + return "http://www.animenewsnetwork.com/encyclopedia/anime.php?id=$id"; +} + sub getthemes { my($html, $kind, @ret); @@ -67,13 +75,13 @@ sub getthemes $ct = {}; $ct->{"num"} = $parts[1] if defined $parts[1]; if(defined $parts[5]) { - $ct->{"tit"} = $parts[5]; + $ct->{"tit"} = decode_entities($parts[5]); $ct->{"jat"} = decode_entities($parts[2]) if defined $parts[2]; } else { - $ct->{"tit"} = $parts[2] if defined $parts[2]; + $ct->{"tit"} = decode_entities($parts[2]) if defined $parts[2]; } - $ct->{"ent"} = $parts[7] if defined $parts[7]; - $ct->{"prf"} = $parts[8] if defined $parts[8]; + $ct->{"ent"} = decode_entities($parts[7]) if defined $parts[7]; + $ct->{"prf"} = decode_entities($parts[8]) if defined $parts[8]; $ct->{"fep"} = $parts[10] if defined $parts[10]; $ct->{"lep"} = $parts[11] if defined $parts[11]; push @ret, $ct; @@ -89,9 +97,9 @@ sub getseries my($id, $buf, $html, %ret); ($id) = @_; - $html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?id=$id"; + $html = _get geturl $id; - $ret{"url"} = "http://www.animenewsnetwork.com/encyclopedia/anime.php?id=$id"; + $ret{"url"} = geturl $id; ($buf) = ($html =~ /\Anime News Network - ([^<]*)<\/TITLE>/); if($buf =~ /\([^\)]+\)$/) { ($ret{"name"}, $ret{"type"}) = ($buf =~ /^(.*[^\s])\s*\(([^\)]+)\)$/);