Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ def generate_embed_link(tmdb_id, media_type):
|
|
| 24 |
|
| 25 |
# Streamlit app layout
|
| 26 |
st.title("TMDb Movie & TV Show Search")
|
| 27 |
-
st.write("Search for a movie or TV show and get 5 results with TMDb ID and embed link.")
|
| 28 |
|
| 29 |
# Input fields for search query and media type
|
| 30 |
query = st.text_input("Enter the movie or TV show name:")
|
|
@@ -40,13 +40,23 @@ if st.button("Search"):
|
|
| 40 |
for result in results:
|
| 41 |
title = result["title"] if media_type == "movie" else result["name"]
|
| 42 |
tmdb_id = result["id"]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
embed_link = generate_embed_link(tmdb_id, media_type)
|
| 44 |
-
|
|
|
|
| 45 |
st.write(f"**TMDb ID:** {tmdb_id}")
|
|
|
|
|
|
|
| 46 |
st.write(f"**Embed Link:** [Watch here]({embed_link})")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
st.write("---")
|
| 48 |
else:
|
| 49 |
st.write("No results found. Please try a different query.")
|
| 50 |
else:
|
| 51 |
st.write("Please enter a search query and ensure the API key is set.")
|
| 52 |
-
|
|
|
|
| 24 |
|
| 25 |
# Streamlit app layout
|
| 26 |
st.title("TMDb Movie & TV Show Search")
|
| 27 |
+
st.write("Search for a movie or TV show and get 5 results with TMDb ID, thumbnail, description, release date, and embed link.")
|
| 28 |
|
| 29 |
# Input fields for search query and media type
|
| 30 |
query = st.text_input("Enter the movie or TV show name:")
|
|
|
|
| 40 |
for result in results:
|
| 41 |
title = result["title"] if media_type == "movie" else result["name"]
|
| 42 |
tmdb_id = result["id"]
|
| 43 |
+
description = result.get("overview", "No description available.")
|
| 44 |
+
release_date = result.get("release_date") if media_type == "movie" else result.get("first_air_date", "N/A")
|
| 45 |
+
poster_path = result.get("poster_path")
|
| 46 |
+
thumbnail = f"https://image.tmdb.org/t/p/w500{poster_path}" if poster_path else None
|
| 47 |
embed_link = generate_embed_link(tmdb_id, media_type)
|
| 48 |
+
|
| 49 |
+
st.write(f"### {title}")
|
| 50 |
st.write(f"**TMDb ID:** {tmdb_id}")
|
| 51 |
+
st.write(f"**Release Date:** {release_date}")
|
| 52 |
+
st.write(f"**Description:** {description}")
|
| 53 |
st.write(f"**Embed Link:** [Watch here]({embed_link})")
|
| 54 |
+
|
| 55 |
+
if thumbnail:
|
| 56 |
+
st.image(thumbnail, width=200)
|
| 57 |
+
|
| 58 |
st.write("---")
|
| 59 |
else:
|
| 60 |
st.write("No results found. Please try a different query.")
|
| 61 |
else:
|
| 62 |
st.write("Please enter a search query and ensure the API key is set.")
|
|
|