My Project 4: Movie Search App (with Python + Streamlit)

Published: (December 2, 2025 at 05:53 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

🧱 1. Project Overview

The Movie Search App allows you to:

  • Enter a movie title
  • Fetch detailed movie information
  • View poster, genre, plot, and rating
  • Use either console or Streamlit web interface

📂 2. Project Structure

movie_app/

├── movie_app.py                 # Console version
├── movie_app_streamlit.py       # Streamlit version
└── README.md                    # (optional)

🌐 3. API Used: OMDb API

OMDb requires a free API key. Get one here:
🔗 https://www.omdbapi.com/apikey.aspx

🖥️ 4. Console Version (movie_app.py)

Key Features

  • Fetch movie data using requests
  • Handles invalid titles gracefully
  • Displays essential movie details

📌 Code

import requests

API_KEY = "YOUR_API_KEY"  # Put your OMDb API key here

title = input("Movie title: ")

url = f"https://www.omdbapi.com/?t={title}&apikey={API_KEY}"
response = requests.get(url)

if response.status_code != 200:
    print("Error fetching data.")
    exit()

data = response.json()

if data["Response"] == "False":
    print("Movie not found.")
    exit()

print("=== Movie Info ===")
print("Title:", data["Title"])
print("Year:", data["Year"])
print("Genre:", data["Genre"])
print("Plot:", data["Plot"])
print("Rating:", data["imdbRating"])

🌤️ 5. Streamlit Version (movie_app_streamlit.py)

Added Features

  • Poster image display
  • Well‑formatted output UI
  • Error / not‑found handling

📌 Code

import streamlit as st
import requests

st.title("🎬 Sabin's Movie Search App")

API_KEY = "YOUR_API_KEY"

title = st.text_input("Enter movie title:", "Inception")

if st.button("Search"):
    url = f"https://www.omdbapi.com/?t={title}&apikey={API_KEY}"
    response = requests.get(url)

    if response.status_code != 200:
        st.error("Error fetching data.")
    else:
        data = response.json()

        if data["Response"] == "False":
            st.warning("Movie not found.")
        else:
            st.subheader(f"{data['Title']} ({data['Year']})")

            if data["Poster"] != "N/A":
                st.image(data["Poster"], width=300)
            else:
                st.info("No poster available.")

            st.write(f"Genre: {data['Genre']}")
            st.write(f"Rating: ⭐ {data['imdbRating']}")
            st.write(f"Plot: {data['Plot']}")

⚙️ 6. How to Run

✔ Console Version

python3 movie_app.py

✔ Streamlit Version

pip install streamlit
streamlit run movie_app_streamlit.py

📚 7. What I Learned

  • Working with authenticated APIs
  • Error handling for missing data
  • Displaying images in Streamlit
  • CLI vs. web app differences

🔧 8. Future Improvements

  • Search by keyword instead of exact title
  • Show similar or recommended movies
  • Save favorite movies
  • Add Rotten Tomatoes / Metacritic ratings
  • Dark mode UI
Back to Blog

Related posts

Read more »