From 0ed00762e570c34a607e0ef808da885822824761 Mon Sep 17 00:00:00 2001 From: jcvignoli Date: Thu, 3 Aug 2023 18:23:14 -0500 Subject: [PATCH] update bio --- src/Imdb/Person.php | 189 ++++++++++++++++++++++++++++---------------- src/Imdb/Title.php | 2 +- 2 files changed, 120 insertions(+), 71 deletions(-) diff --git a/src/Imdb/Person.php b/src/Imdb/Person.php index 7047bbce..30feb879 100644 --- a/src/Imdb/Person.php +++ b/src/Imdb/Person.php @@ -485,16 +485,20 @@ public function movies_archive() * @return string birthname * @see IMDB person page /bio */ - public function birthname() - { - if (empty($this->birth_name)) { - $page = $this->getPage("Bio"); - if (preg_match("!Birth Name\s*(.*?)\n!m", $page, $match)) { - $this->birth_name = trim($match[1]); - } +// updated by @jc_vignoli 3.8.2023 +public function birthname() +{ + if (empty($this->birth_name)) { + $this->getPage("Bio"); + if (preg_match("!Birth Name(.*?)\n!m", $this->page["Bio"], $match)) { + $this->birth_name = trim($match[1]); + } elseif (preg_match('|Birth name","htmlContent":"(.*?)"}|ims', $this->page["Bio"], $match)) { + $this->birth_name = trim($match[1]); } - return $this->birth_name; } + return $this->birth_name; +} + #-------------------------------------------------------------[ Nick Name ]--- @@ -502,25 +506,35 @@ public function birthname() * @return array nicknames array[0..n] of strings * @see IMDB person page /bio */ - public function nickname() - { - if (empty($this->nick_name)) { - $page = $this->getPage("Bio"); - if (preg_match("!Nicknames\s*\s*(.*?)\s*!ms", $page, $match)) { - $nicks = explode("
", $match[1]); - foreach ($nicks as $nick) { - $nick = trim($nick); - if (!empty($nick)) { - $this->nick_name[] = $nick; - } +// updated by @jc_vignoli 3.8.2023 +public function nickname() +{ + if (empty($this->nick_name)) { + $this->getPage("Bio"); + if (preg_match("!Nicknames\s*\s*(.*?)\s*!ms", $this->page["Bio"], $match)) { + $nicks = explode("
", $match[1]); + foreach ($nicks as $nick) { + $nick = trim($nick); + if (!empty($nick)) { + $this->nick_name[] = $nick; + } + } + } elseif (preg_match('!Nickname\s*([^<]+)\s*!', $this->page["Bio"], $match)) { + $this->nick_name[] = trim($match[1]); + } elseif (preg_match('/Nicknames","listContent":\\[[^\\]](.*?)\\]\\}/i', $this->page["Bio"], $match)) { + $nicks = explode(",", $match[1]); + foreach ($nicks as $nick) { + if (preg_match('|:"(.*?)"|ims', $nick, $match)) { + $nick = trim($match[1]); + } + if (!empty($nick)) { + $this->nick_name[] = $nick; } - } elseif (preg_match('!Nickname\s*([^<]+)\s*!', $page, $match)) { - $this->nick_name[] = trim($match[1]); } } - return $this->nick_name; } - + return $this->nick_name; +} #------------------------------------------------------------------[ Born ]--- /** Get Birthday @@ -528,24 +542,37 @@ public function nickname() * where month is the month name, and mon the month number * @see IMDB person page /bio */ - public function born() - { - if (empty($this->birthday)) { - if (preg_match('|Born(.*)getPage("Bio"), $match)) { - preg_match('|/search/name\?birth_monthday=(\d+)-(\d+).*?\n?>(.*?) \d+<|', $match[1], $daymon); - preg_match('|/search/name\?birth_year=(\d{4})|ims', $match[1], $dyear); - preg_match('|/search/name\?birth_place=.*?"\s*>(.*?)<|ims', $match[1], $dloc); - $this->birthday = array( - "day" => @$daymon[2], - "month" => @$daymon[3], - "mon" => @$daymon[1], - "year" => @$dyear[1], - "place" => @$dloc[1] - ); - } +// updated by @jc_vignoli 3.8.2023 +public function born() +{ + if (empty($this->birthday)) { + if (preg_match('|Born(.*)getPage("Bio"), $match)) { + preg_match('|/search/name\?birth_monthday=(\d+)-(\d+).*?\n?>(.*?) \d+<|', $match[1], $daymon); + preg_match('|/search/name\?birth_year=(\d{4})|ims', $match[1], $dyear); + preg_match('|/search/name\?birth_place=.*?"\s*>(.*?)<|ims', $match[1], $dloc); + $this->birthday = array( + "day" => @$daymon[2], + "month" => @$daymon[3], + "mon" => @$daymon[1], + "year" => @$dyear[1], + "place" => @$dloc[1] + ); + } elseif (preg_match('|Born(.*)|iUms', $this->getPage("Bio"), $match)) { + preg_match('|/search/name/\?birth_monthday=(\d+)-(\d+).*?\n?>(.*?) \d+<|', $match[1], $daymon); + preg_match('|/search/name/\?birth_year=(\d{4})|ims', $match[1], $dyear); + preg_match('|/search/name/\?birth_place=.*?"\s*>(.*?)<|ims', $match[1], $dloc); + $this->birthday = array( + "day" => @$daymon[2], + "month" => @$daymon[3], + "mon" => @$daymon[1], + "year" => @$dyear[1], + "place" => @$dloc[1] + ); } - return $this->birthday; + } + return $this->birthday; +} #------------------------------------------------------------------[ Died ]--- @@ -555,26 +582,40 @@ public function born() * where month is the month name, and mon the month number * @see IMDB person page /bio */ - public function died() - { - if (empty($this->deathday)) { - $page = $this->getPage("Bio"); - if (preg_match('|Died(.*?)(.*?) \d+<|', $match[1], $daymonyear); - preg_match('|/search/name\?death_place=.*?"\s*>(.*?)<|ims', $match[1], $dloc); - preg_match('/\(([^\)]+)\)/ims', $match[1], $dcause); - $this->deathday = array( - "day" => @$daymonyear[3], - "month" => @$daymonyear[4], - "mon" => @$daymonyear[2], - "year" => @$daymonyear[1], - "place" => @trim(strip_tags($dloc[1])), - "cause" => @$dcause[1] - ); - } +// updated by @jc_vignoli 3.8.2023 +public function died() +{ + if (empty($this->deathday)) { + $page = $this->getPage("Bio"); + if (preg_match('|Died(.*?)(.*?) \d+<|', $match[1], $daymonyear); + preg_match('|/search/name\?death_place=.*?"\s*>(.*?)<|ims', $match[1], $dloc); + preg_match('/\(([^\)]+)\)/ims', $match[1], $dcause); + $this->deathday = array( + "day" => @$daymonyear[3], + "month" => @$daymonyear[4], + "mon" => @$daymonyear[2], + "year" => @$daymonyear[1], + "place" => @trim(strip_tags($dloc[1])), + "cause" => @$dcause[1] + ); + } elseif (preg_match('|Died(.*)|iUms', $this->getPage("Bio"), $match)) { + preg_match('|/search/name/\?death_date=(\d+)-(\d+)-(\d+).*?\n?>(.*?) \d+<|', $match[1], $daymonyear); + preg_match('|/search/name/\?death_date=(\d{4})|ims', $match[1], $dyear); + preg_match('|/search/name/\?death_place=.*?"\s*>(.*?)<|ims', $match[1], $dloc); + preg_match('/\(([^\)]+)\)/ims', $match[1], $dcause); + $this->deathday = array( + "day" => @$daymonyear[3], + "month" => @$daymonyear[4], + "mon" => @$daymonyear[2], + "year" => @$daymonyear[1], + "place" => @trim(strip_tags($dloc[1])), + "cause" => @$dcause[1] + ); } - return $this->deathday; } + return $this->deathday; +} #-----------------------------------------------------------[ Body Height ]--- @@ -765,28 +806,36 @@ public function bio() return array(); } // no such page if (preg_match( - '!

Mini Bio[^>]+?>(.+?)<(h4 class="li_group"|div class="article")!ims', +/** '!

Mini Bio[^>]+?>(.+?)<(h4 class="li_group"|div class="article")!ims', */ +// updated by @jc_vignoli 3.8.2023 + '!

Mini Bio<\/span>(.+?)role="presentation"><\/div><\/div><\/li><\/ul><\/div><\/section>!ims', $page, $block )) { preg_match_all( - '!
\s*(?.+?)\s

\s*

- IMDb Mini Biography By:\s*(?.+?)\s*!ims', +// updated by @jc_vignoli 3.8.2023 + '!

(?.+?)(