popcorn-api
popcorn-api copied to clipboard
Include themoviedb ids and cast / credits?
I'm currently manually using "themoviedb" to make 2 request:
- Convert the IMDB ID to a TMDB ID.
- Use the TMDB ID to get the directors, writers, creators & cast etc...
Each request takes over a second so it really adds up.
There's no way around that first request but the second one I can do in parallel with the popcorn api request so it's not really a problem.
Alternatively also adding the credits
from themoviedb to popcorn api.
A basic PHP example for getting a TMDB ID using an IMDB ID:
$response = file_get_contents("https://api.themoviedb.org/3/find/".$imdb_id."?".http_build_query(array(
"api_key" => $access_key,
"language" => "en-US",
"external_source" => "imdb_id"
)));
if ($section == "movies" && !empty($response->movie_results)) {
return $response->movie_results[0]->id;
} else if ($section == "shows" && !empty($response->tv_results)) {
return $response->tv_results[0]->id;
} else {
return false;
}