youtube-viewer
Watch YouTube videos from the command line
TLDR
Search for a video
Log in to your YouTube account
Watch a video with a specific URL in VLC
Display a search prompt and play the selected video in 720p
SYNOPSIS
youtube-viewer [options] [search terms or video ID or playlist ID]
PARAMETERS
-h, --help
Display help message and exit
-V, --version
Display version information
--video-player=PLAYER
Specify player: mplayer, mpv, vlc, totem (default: mplayer)
--mpv-opts=OPTIONS
Extra options for mpv
--mplayer-opts=OPTIONS
Extra options for mplayer
--vlc-opts=OPTIONS
Extra options for VLC
--cookies-from-browser=BROWSER
Extract cookies from firefox, chrome, etc., for auth
--video-format=FORMAT
Video format: best, worst, highres, hd1080, etc.
--video-quality=QUALITY
Quality alias: best, worst, small, medium, large, hd720, hd1080
--playlists=ID
Play YouTube playlist by ID
--playlist-start=INDEX
Start playlist from index (default: 1)
--playlist-end=INDEX
End playlist at index
--interface-type=TYPE
Interface: mplayer, mpv, curses (default: curses)
--proxy-server=URL
Use proxy server
--get-video-info
Print video info (title, author, duration, etc.)
--download-with-external-downloader
Download video using external downloader
--subtitles=LANG
Download subtitles in language (e.g., en)
--auto-subtitles
Auto-generate subtitles
--comments=NUM
Fetch top NUM comments
--preferences=FILE
Custom preferences file
--language=LANG
YouTube interface language
--region=REGION
YouTube region (e.g., US)
DESCRIPTION
youtube-viewer is a lightweight, feature-rich command-line tool written in Perl for searching, streaming, and managing YouTube videos directly in the terminal. It fetches video metadata and streams content using external players like mplayer, mpv, or VLC, bypassing the need for a web browser. Key capabilities include keyword-based searches, playlist playback, video format selection (e.g., HD, best quality), subtitle support in multiple languages, and integration with browser cookies for personalized results.
Users can browse related videos, view comments, download videos via external tools like youtube-dl, or customize playback with player-specific options. It supports proxies, region/language preferences, and even traffic percentage monitoring during playback. The tool maintains a preferences file for persistent settings and offers a curses-based interface for navigation.
Ideal for users preferring keyboard-driven workflows, low-bandwidth environments, or scripting automation, youtube-viewer handles YouTube's evolving API by parsing web pages, though it may require updates for compatibility.
CAVEATS
Requires external player (mplayer/mpv/VLC) and Perl modules (LWP::UserAgent, etc.). May break with YouTube updates; check for upstream fixes. No official YouTube API key needed but uses page parsing. High CPU for curses interface on large results.
INSTALLATION
Install via package managers: sudo apt install youtube-viewer (Debian/Ubuntu), yay -S youtube-viewer (Arch). Or from GitHub releases.
PREFERENCES
Settings saved in ~/.config/youtube-viewer/preferences. Edit for defaults like player, quality, language.
HISTORY
Developed by Trizen (tzvika) starting around 2012 as an open-source Perl script on GitHub (github.com/trizen/youtube-viewer). Actively maintained with frequent updates to handle YouTube changes. Available in Arch Linux AUR, Debian repos, and as AppImage. Gained popularity for terminal enthusiasts; version 3.9.x as of 2023.


