diff --git a/src/Imdb/Title.php b/src/Imdb/Title.php index 38ed5caa..32457088 100755 --- a/src/Imdb/Title.php +++ b/src/Imdb/Title.php @@ -2455,6 +2455,7 @@ public function videosites() * @param boolean $spoil *Deprecated*. There are no longer spoiler trivia on imdb * @return array trivia (array[0..n] string * @see IMDB page /trivia + * @version Limited to 5 trivias */ public function trivia($spoil = false) { @@ -2465,16 +2466,19 @@ public function trivia($spoil = false) } // no such page if ($spoil) { return []; - } else { - preg_match('!
page["Trivia"], $block); - if (empty($block)) { - preg_match('!
!ims', $this->page["Trivia"], $block); - } } - if (preg_match_all('!
\s*(.*?)\s*
\s*trivia[] = str_replace('href="/', 'href="https://' . $this->imdbsite . "/", $matches[1][$i]); + + if (preg_match_all( + '!
\s*(.*?)\s*
!ims', + str_replace("\n", " ", $page), + $matches + )) { + foreach ($matches[1] as $match) { + $this->trivia[] = str_replace( + 'href="/name/', + 'href="https://' . $this->imdbsite . '/name/', + $match + ); } } }