--- imdb.pl.orig 2007-06-10 15:45:06.000000000 -0400 +++ imdb.pl 2007-06-27 03:19:17.000000000 -0400 @@ -429,16 +433,16 @@ # possible matches are grouped in several catagories: # exact, partial, and approximate my $popular_results = parseBetween($response, "Popular Titles", - ""); + ""); my $exact_matches = parseBetween($response, "Titles (Exact Matches)", - ""); + ""); my $partial_matches = parseBetween($response, "Titles (Partial Matches)", - ""); + ""); # my $approx_matches = parseBetween($response, "Approximate Matches", -# ""); +# ""); # parse movie list from matches - my $beg = "
  • "; - my $end = "
  • "; + my $beg = ""; + my $end = ""; my $count = 0; my @movies; @@ -468,29 +472,18 @@ my $type = ""; my $movienum = ""; - my $link_end = ""; - $fl_end = index($entry, $link_end); - $fl_end += length($link_end); - my $lhs = substr($entry, 0, $fl_end); - my $rhs = substr($entry, $fl_end); - - if ($lhs =~ m/(.+)<\/a>/i) { + if ($entry =~ m/(.+)<\/a> \((\d+)\)(?: \((.+)\))?/i) { $movienum = $1; $title = $2; + $year = $3; + $type = $4 if ($4); } else { if (defined $opt_d) { - print("Unrecognized entry format\n"); + print("Unrecognized entry format ($entry)\n"); } next; } - if ($rhs =~ m/\((\d+)\) \((.+)\)/) { - $year = $1; - $type = $2; - } elsif ($rhs =~ m/\((\d+)\)/) { - $year = $1; - } - my $skip = 0; # fix broken 'tv=no' option