A command-line interface tool that allows you to fetch and display movie information from The Movie Database (TMDB) API. This tool provides a simple way to browse different categories of movies directly from your terminal.
- Fetch movies by different categories (now playing, popular, top rated, upcoming)
- Display detailed movie information including title, release date, overview, and rating
- Support for pagination to browse through multiple pages of results
- Emoji-rich output for better readability
- Go 1.24 or higher
- TMDB API key (get it from https://www.themoviedb.org/settings/api)
- Clone the repository:
git clone https://github.com/yourusername/tmdb-cli-tool.git
cd tmdb-cli-tool- Create a
.envfile in the root directory based on the provided.env.example:
cp .env.example .env- Edit the
.envfile and add your TMDB API key:
TMDB_API_KEY=your_api_key_here
TMDB_API_URL=https://api.themoviedb.org/3
- Build the application:
go build -o tmdb-appThe basic command structure is:
./tmdb-app -type [movie_list_type] -page [page_number]playing- Now playing movies in theaterspopular- Currently popular moviestop- Top rated movies of all timeupcoming- Upcoming movie releases
Fetch currently playing movies (first page):
./tmdb-app -type playingFetch popular movies (second page):
./tmdb-app -type popular -page 2Fetch top rated movies (third page):
./tmdb-app -type top -page 3Fetch upcoming movies:
./tmdb-app -type upcoming- main.go: Entry point of the application, handles command-line flags and initiates the movie fetch process
- api/client.go: Contains functions to interact with the TMDB API
- cmd/commands.go: Implements the command logic for fetching and displaying movie information
- config/config.go: Handles loading environment variables from the .env file
- models/movie.go: Defines data structures for movie information and API responses
This project uses standard Go libraries and does not require any external dependencies beyond the Go standard library.
| Variable | Description |
|---|---|
| TMDB_API_KEY | Your TMDB API key |
| TMDB_API_URL | The base URL for TMDB API (default: https://api.themoviedb.org/3) |
- The Movie Database (TMDB) for providing the API
- roadmap.sh for the project inspiration