Dolda2000 GitWeb
/
utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
loadcpu: Added SNB-optimized spinloop.
[utils.git]
/
ANN.pm
diff --git
a/ANN.pm
b/ANN.pm
index
f41147a
..
6dd02e9
100644
(file)
--- a/
ANN.pm
+++ b/
ANN.pm
@@
-35,12
+35,12
@@
sub _get
$res = $ua->request(HTTP::Request->new("GET", "$uri"));
if(open CACHE, ">:utf8", $cname) {
$res = $ua->request(HTTP::Request->new("GET", "$uri"));
if(open CACHE, ">:utf8", $cname) {
- print CACHE $res->content;
+ print CACHE $res->
decoded_
content;
close CACHE;
}
return undef unless $res->is_success;
close CACHE;
}
return undef unless $res->is_success;
- return $res->content;
+ return $res->
decoded_
content;
}
sub getlist
}
sub getlist
@@
-49,7
+49,7
@@
sub getlist
($name) = @_;
$name = ($name =~ /^(the\s+)?(.*)$/i)[1];
($name) = @_;
$name = ($name =~ /^(the\s+)?(.*)$/i)[1];
- $il = uc(($name =~ /^(.)/)[0]);
+ $il = uc(($name =~ /^
\W*
(.)/)[0]);
$il = "9" if (!($il =~ /[A-Z]/));
if(!($html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?list=$il")) {
return undef;
$il = "9" if (!($il =~ /[A-Z]/));
if(!($html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?list=$il")) {
return undef;
@@
-58,9
+58,9
@@
sub getlist
# The only way to recognize entries that seems sure is to look
# after the "HOVERLINE" class.
# The only way to recognize entries that seems sure is to look
# after the "HOVERLINE" class.
- while($html =~ /<A\s
.*CLASS=HOVERLINE\s.*HREF=\"([^\"]+)\".*>(\<small\>.*\<\/small\>)?
([^<]+)<\//ig) {
- if((substr "" . lc $
3
, 0, length $name) eq lc $name) {
- push @ret, $
3
;
+ while($html =~ /<A\s
+CLASS="HOVERLINE"\s+HREF="([^"]+)"[^>]*>(<FONT[^>]*>)?(<small>[^<]*<\/small>)?\s*
([^<]+)<\//ig) {
+ if((substr "" . lc $
4
, 0, length $name) eq lc $name) {
+ push @ret, $
4
;
}
}
# push @ret, $1 while $html =~ /<A\s.*CLASS=HOVERLINE\s.*>.*<FONT.*>([^<>]*$name[^<>]*)<\/FONT/ig;
}
}
# push @ret, $1 while $html =~ /<A\s.*CLASS=HOVERLINE\s.*>.*<FONT.*>([^<>]*$name[^<>]*)<\/FONT/ig;
@@
-74,7
+74,7
@@
sub getid
($name) = @_;
$name = ($name =~ /^(the\s+)?(.*)$/i)[1];
($name) = @_;
$name = ($name =~ /^(the\s+)?(.*)$/i)[1];
- $il = uc(($name =~ /^(.)/)[0]);
+ $il = uc(($name =~ /^
\W*
(.)/)[0]);
$il = "9" if (!($il =~ /[A-Z]/));
if(!($html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?list=$il")) {
return undef;
$il = "9" if (!($il =~ /[A-Z]/));
if(!($html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?list=$il")) {
return undef;
@@
-83,8
+83,8
@@
sub getid
# The only way to recognize entries that seems sure is to look
# after the "HOVERLINE" class.
# The only way to recognize entries that seems sure is to look
# after the "HOVERLINE" class.
- while($html =~ /<A\s
.*CLASS=HOVERLINE\s.*HREF=\"([^\"]+)\".*>(\<small\>.*\<\/small\>)?
([^<]+)<\//ig) {
- if((substr "" . lc $
3
, 0, length $name) eq lc $name) {
+ while($html =~ /<A\s
+CLASS="HOVERLINE"\s+HREF="([^"]+)"[^>]*>(<FONT[^>]*>)?(<small>[^<]*<\/small>)?\s*
([^<]+)<\//ig) {
+ if((substr "" . lc $
4
, 0, length $name) eq lc $name) {
return ($1 =~ /id=(\d+)$/)[0];
}
}
return ($1 =~ /id=(\d+)$/)[0];
}
}
@@
-107,10
+107,10
@@
sub getthemes
if($html =~ /$kind theme:<\/strong>\s*\n/igc) {
my(@parts, $ct, $buf);
if($html =~ /$kind theme:<\/strong>\s*\n/igc) {
my(@parts, $ct, $buf);
- while($html =~ /\G\s*\<div
\>(([^<>]|\<i\>|<\/i>)+)
<\/div>/igc) {
+ while($html =~ /\G\s*\<div
class=\"tab\"\>(([^<>]|\<i\>|<\/i>)+)(<span[^<>]*>[^<>]*<img[^<>]*>[^<>]*<\/span>)?
<\/div>/igc) {
$buf = $1;
$buf = $1;
- # 0 1 2 3 4 5 6 7 8 9
10 11
- if(@parts = ($buf =~ /(\#(\d+):)?\s*\"([^\"\(]+\S)(\s*\((\<i\>(.*)<\/i>( - \s*)?)?([^<>]+)?\))?\"\s+by\s+([^\(]*[^\(\s])(\s*\(eps
(\d+)-(\d+
)?\))?/i)) {
+ # 0 1 2 3 4 5 6 7 8 9
10 1112
+ if(@parts = ($buf =~ /(\#(\d+):)?\s*\"([^\"\(]+\S)(\s*\((\<i\>(.*)<\/i>( - \s*)?)?([^<>]+)?\))?\"\s+by\s+([^\(]*[^\(\s])(\s*\(eps
? (\d+)(-(\d+)
)?\))?/i)) {
$ct = {};
$ct->{"num"} = $parts[1] if defined $parts[1];
if(defined $parts[5]) {
$ct = {};
$ct->{"num"} = $parts[1] if defined $parts[1];
if(defined $parts[5]) {
@@
-122,7
+122,7
@@
sub getthemes
$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->{"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[1
1] if defined $parts[11
];
+ $ct->{"lep"} = $parts[1
2] if defined $parts[12
];
push @ret, $ct;
}
}
push @ret, $ct;
}
}