A beautiful command-line interface for The Movie Database (TMDB) API that allows you to search for movies, browse trending content, check upcoming releases, and get detailed movie information.
- ๐ฎ Interactive Movie Browser: Browse movies with a beautiful, interactive interface
- โญ Personal Watchlist: Save, manage, and export your favorite movies
- ๐ฏ Smart Recommendations: Get movie suggestions based on movies you like or by genre
- ๐พ Data Persistence: Your watchlist is saved locally between sessions
- ๐ค Export Functionality: Export your watchlist to shareable text files
- ๐จ Enhanced UI: Rich, colorful interface with intuitive navigation
- โก Improved Performance: Faster API calls and better error handling
- ๐ Search Movies: Search for movies by title with pagination support
- ๐ Trending Movies: Browse trending movies for today or this week
- ๐ฌ Upcoming Releases: View upcoming movie releases
- ๐ Movie Details: Get comprehensive information about specific movies
- ๏ฟฝ Interactive Browser: Browse movies with an interactive interface
- โญ Personal Watchlist: Save and manage your favorite movies
- ๐ฏ Smart Recommendations: Get movie suggestions based on preferences
- ๐พ Data Export: Export your watchlist to text files
- ๏ฟฝ๐จ Rich Terminal Output: Beautiful, colored tables and formatted text
- โก Error Handling: Graceful handling of network issues, invalid input, and API errors
- ๐ง Environment Configuration: Secure API key management with
.envfiles
-
Clone this repository:
git clone https://github.com/yourusername/tmdb-cli.git cd tmdb-cli -
Create a virtual environment and install dependencies:
# Create virtual environment python3 -m venv venv # Activate virtual environment source venv/bin/activate # On Windows: venv\Scripts\activate # Install dependencies pip install -r requirements.txt
-
Set up your TMDB API key:
- Get a free API key from The Movie Database
- Copy the
.env.examplefile to.env:cp .env.example .env
- Edit the
.envfile and replaceyour_tmdb_api_key_herewith your actual API key:API_KEY=your_actual_tmdb_api_key_here
You can run the CLI tool in two ways:
./tmdb search "inception"
./tmdb trending --type week
./tmdb upcoming
./tmdb details 550# Activate virtual environment first
source venv/bin/activate
# Then run commands
python tmdb_cli.py search "inception"
python tmdb_cli.py trending --type week
python tmdb_cli.py upcoming
python tmdb_cli.py details 550./tmdb search "inception"
./tmdb search "spider man" --page 2# Trending today (default)
./tmdb trending
# Trending this week
./tmdb trending --type week./tmdb upcoming./tmdb details 550 # Fight Club
./tmdb details 27205 # Inception# Browse popular movies interactively
./tmdb browse
# Browse top rated movies
./tmdb browse --category top_rated
# Browse currently playing movies
./tmdb browse --category now_playing# View your personal watchlist
./tmdb watchlist
# Add movies to watchlist using the browse command
./tmdb browse # then use 'w' command to manage watchlist# Get recommendations based on a specific movie
./tmdb recommend --movie-id 27205 # Based on Inception
# Get recommendations by genre
./tmdb recommend --genre "science fiction"
./tmdb recommend --genre "action"
# Get personalized recommendations (requires watchlist)
./tmdb recommend| Command | Description | Options |
|---|---|---|
search <query> |
Search for movies by title | --page, -p: Page number (default: 1) |
trending |
Get trending movies | --type: day or week (default: day) |
upcoming |
Show upcoming movie releases | None |
details <movie_id> |
Get detailed movie information | Movie ID (required) |
browse |
Interactive movie browser | --category: popular, top_rated, now_playing |
watchlist |
Manage personal watchlist | Interactive management options |
recommend |
Get movie recommendations | --movie-id: Based on movie, --genre: By genre |
# Show help
./tmdb --help
# Show version
./tmdb --version
# Help for specific commands
./tmdb search --helpThe interactive browser (./tmdb browse) provides an immersive way to discover movies:
- Navigation: Use
n(next) andp(previous) to browse pages - Movie Details: Use
d <number>to view detailed information - Watchlist Management: Use
wto add/remove movies from your personal watchlist - Visual Indicators: Movies in your watchlist are marked with โญ
- Clean Exit: Use
qto quit the browser
Your personal movie watchlist is stored locally and provides:
- Persistent Storage: Movies are saved between sessions
- Export Functionality: Export your list to text files
- Quick Actions: Add, remove, view details, and clear entire list
- Statistics: Track when movies were added to your list
Get intelligent movie suggestions based on:
- Similar Movies: Find movies like ones you've enjoyed
- Genre Preferences: Discover popular movies in specific genres
- Personal Taste: Recommendations based on your watchlist history
๐ฌ Popular Movies (Page 1/4)
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ 1. The Shawshank Redemption โญ โ
โ ๐
1994-09-23 | โญ 8.7/10 โ
โ Two imprisoned mates bond over a number of years, finding... โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Commands: next | prev | watchlist | details <num> | quit
๐ Your Watchlist (3 movies)
โโโโโฌโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ # โ Title โ Release Date โ Rating โ Added โ
โโโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโโโโโค
โ 1 โ Inception โ 2010-07-15 โ 8.4/10 โ 2025-08-07 โ
โ 2 โ The Dark Knight โ 2008-07-16 โ 8.5/10 โ 2025-08-07 โ
โ 3 โ Interstellar โ 2014-11-05 โ 8.5/10 โ 2025-08-07 โ
โโโโโดโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโโโโโ
Search Results for 'inception'
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Title โ Release Date โ Rating โ Overview โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโผโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Inception โ 2010-07-16 โ 8.4/10 โ Cobb, a skilled thief who commits corporate โ
โ โ โ โ espionage by infiltrating the subconscious... โ
โ Inception: The Cobol Job โ 2010-12-07 โ 7.9/10 โ This Inception prequel unfolds courtesy of a... โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Inception โ
โ Your mind is the scene of the crime โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Release Date July 16, 2010
Rating 8.4/10 (35,275 votes)
Runtime 148 minutes
Budget $160,000,000
Revenue $825,532,764
Genres Action, Science Fiction, Adventure
Production Warner Bros. Pictures, Legendary Entertainment, Syncopy
โญโ Overview โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Cobb, a skilled thief who commits corporate espionage by infiltrating โ
โ the subconscious of his targets, is offered a chance to regain his old โ
โ life as payment for a task considered to be impossible: "inception", โ
โ the implantation of another person's idea into a target's subconscious. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
tmdb-cli/
โโโ .env.example # Environment variables template
โโโ .gitignore # Git ignore patterns
โโโ tmdb_cli.py # Main CLI application (enhanced with new features)
โโโ tmdb # Wrapper script for easy execution
โโโ setup.py # Setup and installation helper
โโโ demo.sh # Demo script showcasing all features
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
# User Data (created automatically)
.env # Your personal API key (not in repo)
venv/ # Virtual environment (not in repo)
~/.tmdb_watchlist.json # Personal watchlist storage
tmdb_watchlist_*.txt # Exported watchlist files
- requests: HTTP library for API calls
- python-dotenv: Environment variable management
- rich: Beautiful terminal formatting
- click: Command-line interface framework
The tool gracefully handles various error scenarios:
- Invalid API Key: Clear error message for authentication issues
- Network Problems: Timeout and connection error handling
- Invalid Input: Validation for movie IDs and search queries
- No Results: Friendly messages when searches return empty results
- Rate Limiting: Proper HTTP status code handling
This tool uses The Movie Database (TMDB) API. You need a free API key to use this application.
- Create an account at TMDB
- Go to your API settings
- Request an API key
- Copy the API key to your
.envfile
- Quick Movie Lookup: Use
./tmdb details <movie_id>for instant movie information - Genre Discovery: Try
./tmdb recommend --genre "thriller"to discover new genres - Watchlist Shortcuts: In the browser, use
wto quickly manage your watchlist - Export for Sharing: Use the watchlist export feature to share movie lists with friends
- Discovery: Start with
./tmdb browseto discover popular movies - Curation: Add interesting movies to your watchlist using the browser
- Exploration: Use
./tmdb recommendto find similar movies - Organization: Export your watchlist periodically for backup
- Virtual Environment: Make sure to activate your virtual environment with
source venv/bin/activate - Missing Dependencies: If commands fail, ensure you've installed requirements with
pip install -r requirements.txt - API Key Issues: Make sure you've copied
.env.exampleto.envand added your actual API key - Network Issues: The tool handles timeouts gracefully - just retry
- Invalid Movie IDs: Use search to find the correct movie ID first
- Empty Watchlist: Start browsing movies to build your personal collection
- API Limits: The free TMDB API has generous limits for personal use
Feel free to submit issues, feature requests, or pull requests to improve this tool.
This project was inspired by the TMDB CLI project from roadmap.sh - a fantastic resource for learning and building practical development projects. The roadmap.sh community provides excellent project ideas and learning paths for developers of all levels.
This project is open source and available under the MIT License.