Dolda2000 GitWeb
/
utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update for new ann html schema.
[utils.git]
/
ANN.pm
diff --git
a/ANN.pm
b/ANN.pm
index
1406c45
..
746cf15
100644
(file)
--- a/
ANN.pm
+++ b/
ANN.pm
@@
-48,6
+48,7
@@
sub getlist
my($name, $il, $html, @ret);
($name) = @_;
my($name, $il, $html, @ret);
($name) = @_;
+ $name = ($name =~ /^(the\s+)?(.*)$/i)[1];
$il = uc(($name =~ /^(.)/)[0]);
$il = "9" if (!($il =~ /[A-Z]/));
if(!($html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?list=$il")) {
$il = uc(($name =~ /^(.)/)[0]);
$il = "9" if (!($il =~ /[A-Z]/));
if(!($html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?list=$il")) {
@@
-57,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=\"([^\"]+)\".*>([^<]+)<\//ig) {
- if((substr "" . lc $
2
, 0, length $name) eq lc $name) {
- push @ret, $
2
;
+ while($html =~ /<A\s.*CLASS=HOVERLINE\s.*HREF=\"([^\"]+)\".*>(
\<small\>.*\<\/small\>)?(
[^<]+)<\//ig) {
+ if((substr "" . lc $
3
, 0, length $name) eq lc $name) {
+ push @ret, $
3
;
}
}
# 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;
@@
-72,6
+73,7
@@
sub getid
my($name, $il, $html, $url);
($name) = @_;
my($name, $il, $html, $url);
($name) = @_;
+ $name = ($name =~ /^(the\s+)?(.*)$/i)[1];
$il = uc(($name =~ /^(.)/)[0]);
$il = "9" if (!($il =~ /[A-Z]/));
if(!($html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?list=$il")) {
$il = uc(($name =~ /^(.)/)[0]);
$il = "9" if (!($il =~ /[A-Z]/));
if(!($html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?list=$il")) {
@@
-81,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=\"([^\"]+)\".*>([^<]+)<\//ig) {
- if((substr "" . lc $
2
, 0, length $name) eq lc $name) {
+ while($html =~ /<A\s.*CLASS=HOVERLINE\s.*HREF=\"([^\"]+)\".*>(
\<small\>.*\<\/small\>)?(
[^<]+)<\//ig) {
+ if((substr "" . lc $
3
, 0, length $name) eq lc $name) {
return ($1 =~ /id=(\d+)$/)[0];
}
}
return ($1 =~ /id=(\d+)$/)[0];
}
}
@@
-103,12
+105,12
@@
sub getthemes
my($html, $kind, @ret);
($html, $kind) = @_;
my($html, $kind, @ret);
($html, $kind) = @_;
- if($html =~ /$kind theme:<\/
b>
\n/igc) {
+ if($html =~ /$kind theme:<\/
strong>\s*
\n/igc) {
my(@parts, $ct, $buf);
my(@parts, $ct, $buf);
- while($html =~ /\G\
<br\> (([^<>]|\<i\>|<\/i>)+)
/igc) {
+ while($html =~ /\G\
s*\<div\>(([^<>]|\<i\>|<\/i>)+)<\/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 11
+ 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]) {
@@
-145,13
+147,13
@@
sub getseries
} else {
$ret{"name"} = $buf;
}
} else {
$ret{"name"} = $buf;
}
- if(($buf) = ($html =~ /vintage:<\/
b>\n
([^<]+)</is)) {
+ if(($buf) = ($html =~ /vintage:<\/
strong>\s*\n\s*<span>
([^<]+)</is)) {
$ret{"vtg"} = $buf;
}
$ret{"vtg"} = $buf;
}
- if(($buf) = ($html =~ /number of episodes:<\/
b>\n
([^<]+)</is)) {
+ if(($buf) = ($html =~ /number of episodes:<\/
strong>\s*\n\s*<span>
([^<]+)</is)) {
$ret{"eps"} = $buf;
}
$ret{"eps"} = $buf;
}
- if(($buf) = ($html =~ /genres:<\/
b>\n
([^<]+)</is)) {
+ if(($buf) = ($html =~ /genres:<\/
strong>\s*\n\s*
([^<]+)</is)) {
$ret{"gnr"} = [split /, /, $buf];
}
$buf = getthemes $html, "opening";
$ret{"gnr"} = [split /, /, $buf];
}
$buf = getthemes $html, "opening";