Subject: | No Plot |
It looks like IMDB changed their layout and added a blank <p> tag before
the plot. The parser just checks the first <p> tag for the plot, so
it's not returning anything. I also added a next-tag check to avoid
grabbing the description from the "related movie" area when there is no
plot (such as the movie "Cold War").
I'm not fluent with HTML::TokeParser but I changed the plot parsing
section, in the "rating "subroutine in Film.pm to this:
unless($self->{_plot}) {
while(my $tag = $parser->get_tag('p')) {
last if $tag->[1]{'itemprop'} && $tag->
[1]{'itemprop'} eq "description";
}
my $plot = $parser->get_trimmed_text('/p');
my $nextTag = $parser->get_tag('div');
if (! ($nextTag->[0] eq "div" && $nextTag->[1]->
{'class'} && $nextTag->[1]->{'class'} eq "rec-jaw-lower") ) {
$self->{_plot} = $plot;
}
}
..And it now returns the plot (or no plot if a plot is not available)