yewtube Is A Feature Packed Terminal Based YouTube Player

yewtube play youtube video from command line with mpv

yewtube is a command-line tool to search, browse, and play YouTube videos directly from your terminal, for Linux, macOS, and Microsoft Windows. It uses no API keys, and it can play audio only or audio/video using a third-party media player like VLC, mpv or mplayer, with lots of features on top.

yewtube is a fork of mps-youtube, which had its last release in back in 2018. This January, yewtube was merged back in mps-youtube, and its development continues at https://github.com/mps-youtube/yewtube. The fork is a year old, and it contains numerous bug fixes as well as some minor new features such as the ability to run yewtube over tor using torsocks, and the ability to set the mplayer cache.

The application's main purpose is to serve as a terminal YouTube music player, offering options to:

  • search and play audio
  • create and save local playlists
  • search and open YouTube playlists
  • local play history
  • set the default media formats

With extra options such as:

  • play video externally using mpv, mplayer, or vlc
  • audio/video download
  • view video information and comments
  • optional notifications on song change
  • optional MPRIS v2 support
  • last.fm scrobbling support

yewtube is written in Python3, and for interacting with YouTube it uses pafy, a Python library to download YouTube content and retrieve metadata. It doesn't support logging in to YouTube, so anything related to that is not supported (e.g. posting comments).

You might also like: ytfzf - Search (With Thumbnails) And Play YouTube Videos From A Terminal

yewtube search results
yewtube search results

yewtube command line youtube player video info
Video information

yewtube help
yewtube help topics

This is a powerful and flexible tool that offers a simple and efficient way to search, browse, and play YouTube videos from your terminal. Whether you're a Linux user looking for a lightweight music player, or a macOS or Windows user who prefers a command-line interface, yewtube is definitely worth checking out.

Below you'll find instructions for installing yewtube using pipx, and a quick getting started guide.


Install yewtube


The easiest way to install yewtube is using pipx

On Linux, install pipx from your distribution's repositories:

  • Debian, Ubuntu and Linux distributions based on these (Linux Mint, Elementary OS, Pop!_OS, Zorin OS, etc.):
sudo apt install pipx

  • Fedora:
sudo dnf install pipx

  • Arch Linux / Manjaro:
sudo pacman -S python-pipx

  • openSUSE:
sudo zypper install python-pipx

Once pipx is installed, run the following command to ensure directories necessary for pipx operation are in your PATH:

pipx ensurepath

Now you can install yewtube using pipx:

pipx install yewtube

Later when you want to upgrade it, you can do it using: 

pipx upgrade yewtube

You'll also want to install a media player to use with yewtube, from the following 3: VLC, mpv or mplayer. On Linux, you can install these from your Linux distribution's repositories.

You might like: How To Download A YouTube Playlist And Convert It To MP3 Using youtube-dl or yt-dlp (Command Line)


Getting started with yewtube


Start using yewtube by typing the following command in a terminal:

yt

You may want to start by configuring yewtube. I'd recommend starting with:

- if you want to disable playing videos (with this set to false, yewtube will only play audio; it's set to true by default):

set show_video false


set the media player to use for playback:

set player <player>

where <player> is mpv, mplayer or vlc.

If you use VLC as the player, you've disabled showing the video in yewtube, and want to suppress the VLC GUI from showing up:

set vlc_dummy_interface true

You can view the currently active configuration by typing set.

yewtube is quite customizable. For instance, the search results screen can be configured to display additional fields. To see all the available configuration options, type help config in yewtube.

After finishing with the configuration, start using yewtube. Initiate a search by entering / followed by search terms. To play a track, enter its number and press ENTER. You can specify more items separating them by commas, and also include ranges, e.g. play tracks from 1 to 5, 7 and 9: 1-5,7,9.

Use n and p to continue search to next/previous pages. Type p <number> to switch to page <number>.

View a video's information (view count, likes and dislikes, published date, author, etc.) by typing i followed by the item's number. Type c <number> to view a video's comments.

The application comes with an extensive help. To learn more about a feature and how to use it, check out the help inside yewtube, by typing help.

YouTube-related: How To Cast YouTube Videos From Your Phone To Raspberry Pi Using YouTube On TV (youtube.com/tv)