diff --git a/imdb.class.php b/imdb.class.php index 537f49b..5bbd232 100644 --- a/imdb.class.php +++ b/imdb.class.php @@ -74,7 +74,7 @@ class IMDB const IMDB_ID = '~((?:tt\d{6,})|(?:itle\?\d{6,}))~'; const IMDB_LANGUAGE = '~(.*)<\/a>~Ui'; const IMDB_LOCATION = '~href="\/search\/title\?locations=(.*)">(.*)<\/a>~Ui'; - const IMDB_LOCATIONS = '~href="\/search\/title\?locations=[^>]*>\s?(.*)\s?<\/a>[^"]*
\s?(.*)\s<\/dd>~Ui'; + const IMDB_LOCATIONS = '~href="(?\/search\/title\/\?locations=[^>]*)">\s?(?.*)\s?<\/a>\((?.*)\)<\/p>~Ui'; const IMDB_MPAA = '~
  • (?:\s+)(TV-Y|TV-Y7|TV-G|TV-PG|TV-14|TV-MA|G|PG|PG-13|R|NC-17|NR|UR)(?:\s+)<\/li>~Ui'; const IMDB_MUSIC = '~Music by\s*<\/h4>.*(.*)
    ~Us'; const IMDB_NAME = '~href="/name/(.+)/?(?:\?[^"]*)?"[^>]*>(.+)
    ~Ui'; @@ -1441,8 +1441,7 @@ public function getLocationAsUrl($sTarget = '') /** * Returns all locations * - * @return string location - * @return string specification + * @return string|array locations */ public function getLocations() { @@ -1464,7 +1463,7 @@ public function getLocations() return IMDBHelper::arrayOutput($this->bArrayOutput, $this->sSeparator, self::$sNotFound, $aReturn); } else { - $fullLocations = sprintf('https://www.imdb.com/title/tt%s/locations', $this->iId); + $fullLocations = sprintf('https://www.imdb.com/title/tt%s/locations/', $this->iId); $aCurlInfo = IMDBHelper::runCurl($fullLocations); $sSource = $aCurlInfo['contents'] ?? false; @@ -1480,15 +1479,12 @@ public function getLocations() if ($aReturned) { $aReturn = []; - foreach ($aReturned[1] as $i => $strName) { + foreach ($aReturned['url'] as $i => $strName) { if (strpos($strName, '(') === false) { $aReturn[] = [ - 'location' => IMDBHelper::cleanString($strName), - ]; - } - if (strpos($aReturned[2][$i], '(') !== false) { - $aReturn[] = [ - 'specification' => IMDBHelper::cleanString($aReturned[2][$i]), + 'url' => IMDBHelper::cleanString($aReturned['url'][$i]), + 'location' => IMDBHelper::cleanString($aReturned['location'][$i]), + 'specification' => IMDBHelper::cleanString($aReturned['specification'][$i]), ]; } }