Subject: | [PATCH] Fix cast() parser to pick up changes in IMDB HTML |
Fix the parser within cast() to correctly pick up the main cast.
Subject: | IMDB-Film.patch |
--- IMDB/Film.pm.orig 2013-01-02 10:28:08.000000000 -0700
+++ IMDB/Film.pm 2016-01-10 16:08:16.647756210 -0700
@@ -1029,16 +1029,16 @@
}
while($tag = $parser->get_tag()) {
last if $tag->[0] eq 'a' && $tag->[1]{href} && $tag->[1]{href} =~ /fullcredits/i;
- if($tag->[0] eq 'td' && $tag->[1]{class} && $tag->[1]{class} eq 'name') {
+ # if($tag->[0] eq 'td' && $tag->[1]{class} && $tag->[1]{class} eq 'name') {
$tag = $parser->get_tag('a');
if($tag->[1]{href} && $tag->[1]{href} =~ m#name/nm(\d+?)/#) {
$person = $parser->get_text;
$id = $1;
my $text = $parser->get_trimmed_text('/tr');
- ($role) = $text =~ /.*?\s+(.*)$/;
- push @cast, {id => $id, name => $person, role => $role};
+ ($role) = $text =~ /\.\.\. (.*)$/;
+ push @cast, {id => $id, name => $person, role => $role} if $person;
}
- }
+ # }
}
$self->{_cast} = \@cast;