tboothman / imdbphp

PHP library for retrieving film and tv information from IMDb
251 stars 84 forks source link

Quick fix - birth name #302

Open GeorgeFive opened 1 year ago

GeorgeFive commented 1 year ago

Function currently does not work. Quick and easy, remove:

\s*

...from line 492 and it works as expected.

Nicknames:

public function nickname()
{
    if (empty($this->nick_name)) {
        $this->getPage("Bio");
        if (preg_match("!Nicknames</td>\s*<td>\s*(.*?)</td>\s*</tr>!ms", $this->page["Bio"], $match)) {
            $nicks = explode("<br>", $match[1]);
            foreach ($nicks as $nick) {
                $nick = trim($nick);
                if (!empty($nick)) {
                    $this->nick_name[] = $nick;
                }
            }
        } elseif (preg_match('!Nickname</td><td>\s*([^<]+)\s*</td>!', $this->page["Bio"], $match)) {
            $this->nick_name[] = trim($match[1]);
        }
    }
    return $this->nick_name;
}

Note that there are two versions of the bio page (see #303).... this works on the old bio page, but not on the new.