public function results()
{
$page = $this->getPage();
// make sure to catch col #3, not #1 (pic only)
// photo name 1=id 2=name 3=details
preg_match_all('|<tr.*>\\s*<td.*>.*</td>\\s*<td.*<a href="/name/nm(\\d{7})[^>]*>([^<]+)</a>\\s*(.*)</td>|Uims', $page, $matches);
$mc = count($matches[0]);
$this->logger->debug("[Person Search] {$mc} matches");
$mids_checked = array();
for ($i = 0; $i < $mc; ++$i) {
$pid = $matches[1][$i];
if (in_array($pid, $mids_checked)) {
continue;
}
$mids_checked[] = $pid;
$name = $matches[2][$i];
$info = $matches[3][$i];
$resultPerson = Person::fromSearchResults($pid, $name, $this->config, $this->logger, $this->cache);
if (!empty($info)) {
if (preg_match('|<small>\\((.*),\\s*<a href="/title/tt(\\d{7}).*"\\s*>(.*)</a>\\s*\\((\\d{4})\\)\\)|Ui', $info, $match)) {
$role = $match[1];
$mid = $match[2];
$movie = $match[3];
$year = $match[4];
$resultPerson->setSearchDetails($role, $mid, $movie, $year);
}
}
$this->resu[$i] = $resultPerson;
unset($resultPerson);
}
return $this->resu;
}