Matthew Welch
308b1e1791
The project structure has been changed to make it more manageable and modular. A search feature has been added to the comics page.
27 lines
788 B
Python
27 lines
788 B
Python
import requests
|
|
|
|
API_KEY = "***REMOVED***"
|
|
TMDB_FIND_URL = "https://api.themoviedb.org/3/find/"
|
|
|
|
TMDB_IMG_URL = "https://image.tmdb.org/t/p/original"
|
|
|
|
|
|
def get_movie_data(imdb_id):
|
|
data = {
|
|
"api_key": API_KEY,
|
|
"language": "en-US",
|
|
"external_source": "imdb_id"
|
|
}
|
|
r = requests.get(TMDB_FIND_URL+imdb_id, data=data)
|
|
info = dict(r.json())
|
|
if "status_code" in info.keys():
|
|
print("error getting tmdb data, status code:", info["status_code"])
|
|
return None
|
|
print("tmdb movie title:", info["movie_results"][0]["title"])
|
|
movie_id = info["movie_results"][0]["id"]
|
|
overview = info["movie_results"][0]["overview"]
|
|
poster_path = info["movie_results"][0]["poster_path"]
|
|
backdrop_path = info["movie_results"][0]["backdrop_path"]
|
|
|
|
return movie_id, overview, poster_path, backdrop_path
|