diff --git a/README.md b/README.md index c878418..99aa940 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,12 @@ Since version 5.5.0 the script is licensed under [CC BY-NC-SA 3.0](http://creati ## Changes +5.5.19 +- Fixed IMDB_FULL_CAST and IMDB_YEAR. +- getSitesAsUrl() only returns a link, if the url starts with "http". + 5.5.18 -- The latest pull request I merged broke the caching. Sorry guys, I'll never ever pull a request that easily. +- The latest pull request I merged broke the caching. Sorry guys, I'll never ever pull a request that easily again. - Added caching for getFullCast(). - Minor code changes. diff --git a/imdb.class.php b/imdb.class.php index b80c2fb..2a878d1 100644 --- a/imdb.class.php +++ b/imdb.class.php @@ -23,7 +23,7 @@ * @link http://fabian-beiner.de * @license Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported * - * @version 5.5.18 (August 21st, 2013) + * @version 5.5.19 (October 29th, 2013) */ class IMDBException extends Exception {} @@ -47,7 +47,7 @@ class IMDB { const IMDB_ASPECT_RATIO = '~Aspect Ratio:(.*)~Ui'; const IMDB_BUDGET = '~Budget:(.*) (.*)~Ui'; - const IMDB_FULL_CAST = '~(.*?)~'; + const IMDB_FULL_CAST = '~(.*?)~Ui'; const IMDB_CHAR = '~\s+
(.*)
\s+(.*)~Ui'; const IMDB_COMPANY = '~Production Co:(.*)~Ui'; @@ -81,7 +81,7 @@ class IMDB { const IMDB_TRAILER = '~href="/video/(.*)/(?:\?.*)"(?:.*)itemprop="trailer">~Ui'; const IMDB_URL = '~http://(?:.*\.|.*)imdb.com/(?:t|T)itle(?:\?|/)(..\d+)~i'; const IMDB_VOTES = '~(.*)~Ui'; - const IMDB_YEAR = '~property=\'og:title\' content="(?:.*) \((.*)\)~Ui'; + const IMDB_YEAR = '~

(?:\s+)(?:.*)(?:\s+)\((.*)\)~Ui'; const IMDB_WRITER = '~(?:Writer|Writers):

(.*)~Ui'; // cURL cookie file. @@ -99,7 +99,7 @@ class IMDB { // Define root of this script. private $_strRoot = ''; // Current version. - const IMDB_VERSION = '5.5.18'; + const IMDB_VERSION = '5.5.19'; /** * IMDB constructor. @@ -514,7 +514,7 @@ public function getFullCast($intLimit = FALSE) { $arrReturn = @file_get_contents($fCache); return implode($this->strSeperator, unserialize($arrReturn)); } else { - $fullCastUrl = sprintf('http://www.imdb.com/title/tt%s/fullcredits?ref_=tt_cl_sm#cast', $this->_strId); + $fullCastUrl = sprintf('http://www.imdb.com/title/tt%s/fullcredits', $this->_strId); $arrInfo = $this->doCurl($fullCastUrl, FALSE); if (!$arrInfo) { return $this->strNotFound; @@ -1072,7 +1072,9 @@ public function getSitesAsUrl($strTarget = '') { $arrReturned = $this->matchRegex($strContainer, IMDB::IMDB_SITES_A); if (count($arrReturned[2])) { foreach ($arrReturned[2] as $i => $strName) { - $arrReturn[] = '' . trim($strName) . ''; + if (strtolower(substr($arrReturned[1][$i], 0, 4)) == 'http') { + $arrReturn[] = '' . trim($strName) . ''; + } } return implode($this->strSeperator, $arrReturn); }