Added geturl.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Sun, 7 Aug 2005 23:07:03 +0000 (23:07 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Sun, 7 Aug 2005 23:07:03 +0000 (23:07 +0000)
Decode more entities.

git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@306 959494ce-11ee-0310-bf91-de5d638817bd

ANN.pm

diff --git a/ANN.pm b/ANN.pm
index 90bd24a..2ae48cd 100644 (file)
--- 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 =~ /\<TITLE\>Anime News Network - ([^<]*)<\/TITLE>/);
     if($buf =~ /\([^\)]+\)$/) {
        ($ret{"name"}, $ret{"type"}) = ($buf =~ /^(.*[^\s])\s*\(([^\)]+)\)$/);