Skip to content

Commit

Permalink
Pushed some fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianBeiner committed Oct 3, 2023
1 parent 7593203 commit a1c6bfe
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 44 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log
All notable changes to this project will be documented in this file.

## [6.2.1] - 2023-10-03
### Changed
- Added some fix by @sajjadef98.
- Added some slashes to URLs. Yep, this also fixes stuff.

## [6.2.0] - 2023-10-03
### Changed
- Requiring PHP 8.1+.
Expand Down Expand Up @@ -139,4 +144,5 @@ All notable changes to this project will be documented in this file.
[6.1.8]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.1.7...v6.1.8
[6.1.9]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.1.8...v6.1.9
[6.2.0]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.1.9...v6.2.0
[6.2.1]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.2.0...v6.2.1
[Unreleased]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.1.7...HEAD
58 changes: 29 additions & 29 deletions examples/imdb.tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,35 +49,35 @@

$aTests = [
'Pain & Gain',
'Der Prinz von Ägypten',
'https://www.imdb.com/title/tt0063634',
'https://www.imdb.com/title/tt4456850/',
'https://www.imdb.com/title/tt0033467/',
'https://www.imdb.com/title/tt0033467/',
'https://www.imdb.com/title/tt5680152/reference',
'http://www.imdb.com/title/tt0460681/',
'tt1124379',
'tt0187775 ',
'http://www.imdb.com/title/tt1231587/',
'https://www.imdb.com/title/tt1392190/',
'http://www.imdb.com/title/tt0421974/',
'https://www.imdb.com/title/tt0094618/',
'http://www.imdb.com/title/tt0448157/',
'Matrix',
'Donner Pass',
'If only',
'https://www.imdb.com/title/tt1604113/',
'Wyse Guys',
'http://www.imdb.com/title/tt2005268/',
'Wer ist Clark Rockefeller?',
'North by Northwest',
'Iron Man 2',
'One Tree Hill',
'Formosa Betrayed',
'New York, I Love You',
'https://us.imdb.com/Title?0144117',
'http://www.imdb.com/title/tt1022603/',
'Fabian Beiner never made a movie. Yet!'
// 'Der Prinz von Ägypten',
// 'https://www.imdb.com/title/tt0063634',
// 'https://www.imdb.com/title/tt4456850/',
// 'https://www.imdb.com/title/tt0033467/',
// 'https://www.imdb.com/title/tt0033467/',
// 'https://www.imdb.com/title/tt5680152/reference',
// 'http://www.imdb.com/title/tt0460681/',
// 'tt1124379',
// 'tt0187775 ',
// 'http://www.imdb.com/title/tt1231587/',
// 'https://www.imdb.com/title/tt1392190/',
// 'http://www.imdb.com/title/tt0421974/',
// 'https://www.imdb.com/title/tt0094618/',
// 'http://www.imdb.com/title/tt0448157/',
// 'Matrix',
// 'Donner Pass',
// 'If only',
// 'https://www.imdb.com/title/tt1604113/',
// 'Wyse Guys',
// 'http://www.imdb.com/title/tt2005268/',
// 'Wer ist Clark Rockefeller?',
// 'North by Northwest',
// 'Iron Man 2',
// 'One Tree Hill',
// 'Formosa Betrayed',
// 'New York, I Love You',
// 'https://us.imdb.com/Title?0144117',
// 'http://www.imdb.com/title/tt1022603/',
// 'Fabian Beiner never made a movie. Yet!'
];

set_time_limit(count($aTests) * 15);
Expand Down
29 changes: 14 additions & 15 deletions imdb.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @author Fabian Beiner <[email protected]>
* @license https://opensource.org/licenses/MIT The MIT License
* @link https://github.com/FabianBeiner/PHP-IMDB-Grabber/ GitHub Repository
* @version 6.2.0
* @version 6.2.1
*/
class IMDB
{
Expand Down Expand Up @@ -334,7 +334,7 @@ private function fetchUrl($sSearch, $orgSearch = false, $exactSearch = false)
}

$aCurlInfo = IMDBHelper::runCurl($this->sUrl);
$sSource = $aCurlInfo['contents'];
$sSource = is_bool($aCurlInfo) ? $aCurlInfo : $aCurlInfo['contents'];

if (false === $sSource) {
if (true === self::IMDB_DEBUG) {
Expand Down Expand Up @@ -549,9 +549,9 @@ public function getAkas()

return IMDBHelper::arrayOutput($this->bArrayOutput, $this->sSeparator, self::$sNotFound, $aReturn);
} else {
$fullAkas = sprintf('https://www.imdb.com/title/tt%s/releaseinfo', $this->iId);
$fullAkas = sprintf('https://www.imdb.com/title/tt%s/releaseinfo/', $this->iId);
$aCurlInfo = IMDBHelper::runCurl($fullAkas);
$sSource = $aCurlInfo['contents'] ?? false;
$sSource = is_bool($aCurlInfo) ? $aCurlInfo : $aCurlInfo['contents'];

if (false === $sSource) {
if (true === self::IMDB_DEBUG) {
Expand Down Expand Up @@ -610,9 +610,9 @@ public function getMetaScore()

return IMDBHelper::arrayOutput($this->bArrayOutput, $this->sSeparator, self::$sNotFound, $aReturn);
} else {
$fullCritics = sprintf('https://www.imdb.com/title/tt%s/criticreviews', $this->iId);
$fullCritics = sprintf('https://www.imdb.com/title/tt%s/criticreviews/', $this->iId);
$aCurlInfo = IMDBHelper::runCurl($fullCritics);
$sSource = $aCurlInfo['contents'] ?? false;
$sSource = is_bool($aCurlInfo) ? $aCurlInfo : $aCurlInfo['contents'];

if (false === $sSource) {
if (true === self::IMDB_DEBUG) {
Expand All @@ -627,8 +627,7 @@ public function getMetaScore()
'~metascore_wrap(?:.*)\s+(?:.*)\s+(?:.*)ratingValue\">([0-9]+)<\/span>(?:\s+(?:.*)){4}ratingCount\">([0-9]+)~'
);

if ($aReturned) {
$aReturn = [];
if (count($aReturned[1])) {
$aReturn[] = [
'metascore' => IMDBHelper::cleanString($aReturned[1][0]),
'reviews' => IMDBHelper::cleanString($aReturned[2][0]),
Expand Down Expand Up @@ -674,9 +673,9 @@ public function getMetaCritics()

return IMDBHelper::arrayOutput($this->bArrayOutput, $this->sSeparator, self::$sNotFound, $aReturn);
} else {
$fullCritics = sprintf('https://www.imdb.com/title/tt%s/criticreviews', $this->iId);
$fullCritics = sprintf('https://www.imdb.com/title/tt%s/criticreviews/', $this->iId);
$aCurlInfo = IMDBHelper::runCurl($fullCritics);
$sSource = $aCurlInfo['contents'] ?? false;
$sSource = is_bool($aCurlInfo) ? $aCurlInfo : $aCurlInfo['contents'];

if (false === $sSource) {
if (true === self::IMDB_DEBUG) {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -1610,7 +1609,7 @@ public function getPhotos($iLimit = 0, $bMore = true, $sSize = 'small')
while ($isPage) {
$fullPhotos = sprintf('https://www.imdb.com/title/tt%s/mediaindex?page=%d', $this->iId, $page);
$aCurlInfo = IMDBHelper::runCurl($fullPhotos);
$sSource = $aCurlInfo['contents'];
$sSource = is_bool($aCurlInfo) ? $aCurlInfo : $aCurlInfo['contents'];

if (false === $sSource) {
if (true === self::IMDB_DEBUG) {
Expand Down Expand Up @@ -1829,9 +1828,9 @@ public function getReleaseDates()

return IMDBHelper::arrayOutput($this->bArrayOutput, $this->sSeparator, self::$sNotFound, $aReturn);
} else {
$fullAkas = sprintf('https://www.imdb.com/title/tt%s/releaseinfo', $this->iId);
$fullAkas = sprintf('https://www.imdb.com/title/tt%s/releaseinfo/', $this->iId);
$aCurlInfo = IMDBHelper::runCurl($fullAkas);
$sSource = $aCurlInfo['contents'] ?? false;
$sSource = is_bool($aCurlInfo) ? $aCurlInfo : $aCurlInfo['contents'];

if (false === $sSource) {
if (true === self::IMDB_DEBUG) {
Expand Down Expand Up @@ -2064,7 +2063,7 @@ public function getTVInfo()
$fullEpisodes = sprintf('https://www.imdb.com/title/tt%s/episodes/?season=%d', $this->iId, $page);

$aCurlInfo = IMDBHelper::runCurl($fullEpisodes);
$sSource = $aCurlInfo['contents'];
$sSource = is_bool($aCurlInfo) ? $aCurlInfo : $aCurlInfo['contents'];

if (false === $sSource) {
if (true === self::IMDB_DEBUG) {
Expand Down

0 comments on commit a1c6bfe

Please sign in to comment.