Is there a way to get a actor and all the films IMDB or TMDB numbers he/she is in?
for instance
$client = new MovieScrapper('TMDB_API_KEY');
// Get Person information by TheMovieDB's Person ID
$person = $client->person('1327');
public function person($id)
{
$this->validateKeys(['tmdb' => $id]);
$url = $this->apiUrl . 'person/' . $id . '?append_to_response=external_ids,images&api_key=' . $this->apiKey;
return $this->formatPerson($this->toArray($this->request($url)));
}
/**
* @param $person
* @return Person
*/
private function formatPerson($person)
{
return new Person([
'imdb' => !empty($person['imdb_id']) ? $person['imdb_id'] : null,
'tmdb' => !empty($person['id']) ? $person['id'] : null,
'name' => !empty($person['name']) ? $person['name'] : null,
'aka' => !empty($person['also_known_as']) ? $person['also_known_as'] : null,
'gender' => !empty($person['gender']) ? ($person['gender'] == 1 ? 'female' : ($person['gender'] == 2 ? 'male' : null)) : null,
'birthday' => !empty($person['birthday']) ? $person['birthday'] : null,
'deathday' => !empty($person['deathday']) ? $person['deathday'] : null,
'placeOfBirth' => !empty($person['place_of_birth']) ? $person['place_of_birth'] : null,
'biography' => !empty($person['biography']) ? $person['biography'] : null,
'photo' => !empty($person['profile_path']) ? $this->imageProfilePath . $person['profile_path'] : null,
'photos' => !empty($person['images']['profiles']) ? $this->formatImages($person['images']['profiles'],
$this->imageProfilePath, $person['profile_path']) : null,
]);
}
Is there something I can add to call that returns films IMDB or TMDB numbers he/she is in?
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by Travis Bell
on July 16, 2018 at 12:33 PM
To get all of the films a person has been in, call the /movie_credits method.
Reply by HDVinnie
on July 16, 2018 at 3:21 PM
Great thank you!
I see it returns like this which is great!
The ID
"id": 10521,
I assume is the TMDB ID. Does it return IMDB ID as well anyway?Reply by Travis Bell
on July 17, 2018 at 6:46 PM
You can only get the IMDB ID from the objects /external_ids method. It's not included in all of the list methods (search, discover, credits, etc...)