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];
58 my($html, $kind, @ret);
61 if($html =~ /$kind theme:<\/b>\n/igc) {
62 my(@parts, $ct, $buf);
63 while($html =~ /\G\<br\> (([^<>]|\<i\>|<\/i>)+)/igc) {
65 # 0 1 2 3 4 5 6 7 8 9 10 11
66 if(@parts = ($buf =~ /(\#(\d+):)?\s*\"([^\"\(]+)(\s+\((\<i\>(.*)<\/i>(;\s*)?)?([^<>]+)?\))?\"\s+by\s+([^\(]*[^\(\s])(\s*\(eps (\d+)-(\d+)?\))?/i)) {
68 $ct->{"num"} = $parts[1] if defined $parts[1];
69 if(defined $parts[5]) {
70 $ct->{"tit"} = $parts[5];
71 $ct->{"jat"} = decode_entities($parts[2]) if defined $parts[2];
73 $ct->{"tit"} = $parts[2] if defined $parts[2];
75 $ct->{"ent"} = $parts[7] if defined $parts[7];
76 $ct->{"prf"} = $parts[8] if defined $parts[8];
77 $ct->{"fep"} = $parts[10] if defined $parts[10];
78 $ct->{"lep"} = $parts[11] if defined $parts[11];
89 my($id, $buf, $html, %ret);
92 $html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?id=$id";
94 $ret{"url"} = "http://www.animenewsnetwork.com/encyclopedia/anime.php?id=$id";
95 ($ret{"name"}) = ($html =~ /\<TITLE\>Anime News Network - ([^<]*)<\/TITLE>/);
96 if(($buf) = ($html =~ /vintage:<\/b>\n([^<]+)</is)) {
99 if(($buf) = ($html =~ /number of episodes:<\/b>\n([^<]+)</is)) {
102 $buf = getthemes $html, "opening";
103 $ret{"op"} = $buf if(@{$buf});
104 $buf = getthemes $html, "ending";
105 $ret{"ed"} = $buf if(@{$buf});