A simple wrapper for the YouTube API and MPV player. This tool allows you to effortlessly search for and list YouTube videos, and play them directly using MPV.
NOTE: Windows NOT SUPPORTED
To use this application, you will need a valid YouTube API key. Follow the instructions below to obtain one.
- Navigate to the Google Cloud Console.
- Create a new project and enable the YouTube Data API v3 for that project.
- Go to the API Credentials page and generate an API key.
You can provide your API key in one of two ways:
- With a Command Line Flag:
yt_player --key=<your_api_key>
- As an Environment Variable:
# Linux and macOS
export YT_PLAYER_KEY=<your_api_key>
This program relies on the following dependencies:
- MPV Player: A versatile media player that supports a wide range of formats.
- yt-dlp: A command-line program to download videos from YouTube and other sites.
Most distributions provide the necessary dependencies, which can be installed using your package manager.
- Debian/Ubuntu:
sudo apt install mpv yt-dlp
- macOS (Homebrew):
brew install mpv yt-dlp
We now provide pre-compiled binaries for Windows, macOS, and Linux on the Releases page. Simply download the appropriate binary for your platform and run it.
If you prefer to build the project from source, you can install it using Go's package manager:
go install github.com/elias-gill/yt_player@latest
Alternatively, you can clone the repository and build it locally:
git clone https://github.com/elias-gill/yt_player.git
cd yt_player
go install .
- Search and Play: Quickly search for YouTube videos and play them using MPV.
- User-Friendly Interface: Simple command-line interface for easy navigation and playback.
- Detach mode: You can detach and reattach to the player. Very usefull when you want to quickly open and close tmux floating windows or pannels to control your music.
To see available command line flags use the "--help" flag.
- Support for listing and playing YouTube playlists.
- A playback queue for continuous video playback.
- Custom playlists for saving and managing favorite videos.
We welcome contributions! If you have suggestions for improvements or new features, feel free to:
- Open an issue on GitHub.
- Submit a pull request with your changes.
This project is licensed under the MIT License. See the LICENSE file for more details.