Skip to content

Commit

Permalink
Merge pull request #93 from bla0r/patch-6
Browse files Browse the repository at this point in the history
Update imdb.class.php
  • Loading branch information
FabianBeiner authored Jan 11, 2018
2 parents e3bfef5 + 9fbc0b9 commit e9f303f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ if ($oIMDB->isReady) {

`getAwards()`

**Budget**

`getBudget()`

**Cast**

`getCast($iLimit = 0, $bMore = true)` - `$iLimit` defines the maximum amount of people returned, `$bMore` if "…" should be added to the string if needed
Expand Down
19 changes: 17 additions & 2 deletions imdb.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class IMDB
const IMDB_AKA = '~<td[^>]*>\s*Also\s*Known\s*As\s*</td>\s*<td>(.+)</td>~Uis';
const IMDB_ASPECT_RATIO = '~<td[^>]*>Aspect\s*Ratio</td>\s*<td>(.+)</td>~Uis';
const IMDB_AWARDS = '~<div\s*class="titlereference-overview-section">\s*Awards:(.+)</div>~Uis';
const IMDB_BUDGET = '~<td[^>]*>Budget<\/td>\s*<td>\s*(.*)(?:\(estimated\))\s*<\/td>~Ui';
const IMDB_CAST = '~<td[^>]*itemprop="actor"[^>]*>\s*<a\s*href="/name/([^/]*)/\?[^"]*"[^>]*>\s*<span.+>(.+)</span~Ui';
const IMDB_CERTIFICATION = '~<td[^>]*>\s*Certification\s*</td>\s*<td>(.+)</td>~Ui';
const IMDB_CHAR = '~<td class="character">(?:\s+)<div>(.*)(?:\s+)(?: /| \(.*\)|<\/div>)~Ui';
Expand All @@ -52,7 +53,7 @@ class IMDB
const IMDB_ID = '~((?:tt\d{6,})|(?:itle\?\d{6,}))~';
const IMDB_LANGUAGE = '~<a href="\/language\/(\w+)">(.*)<\/a>~Ui';
const IMDB_LOCATION = '~href="\/search\/title\?locations=(.*)">(.*)<\/a>~Ui';
const IMDB_MPAA = '~<li class="ipl-inline-list__item">(?:\s+)(G|PG|PG-13|R|NC-17|NR|UR)(?:\s+)<\/li>~Ui';
const IMDB_MPAA = '~<li class="ipl-inline-list__item">(?:\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_NAME = '~href="/name/(.+)/?(?:\?[^"]*)?"[^>]*>(.+)</a>~Ui';
const IMDB_NOT_FOUND = '~<h1 class="findHeader">No results found for ~Ui';
const IMDB_PLOT = '~<td[^>]*>\s*Plot\s*Summary\s*</td>\s*<td>\s*<p>(.+)</p>~Ui';
Expand All @@ -72,7 +73,7 @@ class IMDB
const IMDB_USER_REVIEW = '~href="/title/[t0-9]*/reviews"[^>]*>([^<]*)\s*User~Ui';
const IMDB_VOTES = '~"ipl-rating-star__total-votes">\s*\((.*)\)\s*<~Ui';
const IMDB_WRITER = '~<div[^>]*>\s*(?:Writer|Writers)\s*:\s*<ul[^>]*>(.+)</ul>~Ui';
const IMDB_YEAR = '~<span class="titlereference-title-year">(?:\s*)\(<a href="\/search\/title\?year=(?:.*)>(\d{4})<\/a>~Ui';
const IMDB_YEAR = '~og:title\' content="(?:.*)\((?:.*)(\d{4})(?:.*)\)~Ui';

/**
* @var string The string returned, if nothing is found.
Expand Down Expand Up @@ -580,6 +581,20 @@ public function getAwards()
return self::$sNotFound;
}

/**
* @return string The budget of the movie or $sNotFound.
*/
public function getBudget() {
if (true === $this->isReady) {
$sMatch = IMDBHelper::matchRegex($this->sSource, self::IMDB_BUDGET, 1);
if (false !== $sMatch) {
return IMDBHelper::cleanString($sMatch);
}
}

return self::$sNotFound;
}

/**
* @param int $iLimit How many cast members should be returned?
* @param bool $bMore Add … if there are more cast members than printed.
Expand Down

0 comments on commit e9f303f

Please sign in to comment.