13 $ua = LWP::UserAgent->new;
14 $ua->agent("ANNData/$ver ");
16 $res = $ua->request(HTTP::Request->new("GET", "$uri"));
18 die "could not fetch $uri\n" unless $res->is_success;
24 my($name, $il, $html, @ret);
27 $il = uc(($name =~ /^(.)/)[0]);
28 $il = "9" if (!($il =~ /[A-Z]/));
29 $html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?list=$il";
31 # The only way to recognize entries that seems sure is to look
32 # after the "HOVERLINE" class.
34 push @ret, $1 while $html =~ /<A\s.*CLASS=HOVERLINE\s.*>.*<FONT.*>([^<>]*$name[^<>]*)<\/FONT/ig;
41 my($name, $il, $html, $url);
44 $il = uc(($name =~ /^(.)/)[0]);
45 $il = "9" if (!($il =~ /[A-Z]/));
46 $html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?list=$il";
48 # The only way to recognize entries that seems sure is to look
49 # after the "HOVERLINE" class.
51 (($url) = ($html =~ /<A\s.*CLASS=HOVERLINE\s.*HREF=\"([^\"]+)\".*$name/i)) || return;
53 return ($url =~ /\?id=(\d+)$/)[0];
61 return "http://www.animenewsnetwork.com/encyclopedia/anime.php?id=$id";
66 my($html, $kind, @ret);
69 if($html =~ /$kind theme:<\/b>\n/igc) {
70 my(@parts, $ct, $buf);
71 while($html =~ /\G\<br\> (([^<>]|\<i\>|<\/i>)+)/igc) {
73 # 0 1 2 3 4 5 6 7 8 9 10 11
74 if(@parts = ($buf =~ /(\#(\d+):)?\s*\"([^\"\(]+)(\s+\((\<i\>(.*)<\/i>(;\s*)?)?([^<>]+)?\))?\"\s+by\s+([^\(]*[^\(\s])(\s*\(eps (\d+)-(\d+)?\))?/i)) {
76 $ct->{"num"} = $parts[1] if defined $parts[1];
77 if(defined $parts[5]) {
78 $ct->{"tit"} = decode_entities($parts[5]);
79 $ct->{"jat"} = decode_entities($parts[2]) if defined $parts[2];
81 $ct->{"tit"} = decode_entities($parts[2]) if defined $parts[2];
83 $ct->{"ent"} = decode_entities($parts[7]) if defined $parts[7];
84 $ct->{"prf"} = decode_entities($parts[8]) if defined $parts[8];
85 $ct->{"fep"} = $parts[10] if defined $parts[10];
86 $ct->{"lep"} = $parts[11] if defined $parts[11];
97 my($id, $buf, $html, %ret);
100 $html = _get geturl $id;
102 $ret{"url"} = geturl $id;
103 ($buf) = ($html =~ /\<TITLE\>Anime News Network - ([^<]*)<\/TITLE>/);
104 if($buf =~ /\([^\)]+\)$/) {
105 ($ret{"name"}, $ret{"type"}) = ($buf =~ /^(.*[^\s])\s*\(([^\)]+)\)$/);
109 if(($buf) = ($html =~ /vintage:<\/b>\n([^<]+)</is)) {
112 if(($buf) = ($html =~ /number of episodes:<\/b>\n([^<]+)</is)) {
115 $buf = getthemes $html, "opening";
116 $ret{"op"} = $buf if(@{$buf});
117 $buf = getthemes $html, "ending";
118 $ret{"ed"} = $buf if(@{$buf});