A simple bash script to play YouTube videos from terminal.
Supports:
- Music only playback
- List of search results to select from
- Play on infinite loop
- No login required, age restricted videos are also playable
With video | Without video |
---|---|
Lyrics on the right shown using lyrics-in-terminal.
mpv
, yt-dlp
, jq
, curl
, awk
and fzf
.
ytplay [OPTION] query
OPTIONS:
-m, --music Music only mode. No video playback.
-t, --top Play the top search result. No options presented.
-l, --loop Play the media on an infinite loop
-r, --results COUNT Specify the number of options to be presented
-h, --help Show this help
Copy ytplay to your ~/.local/bin
directory, like so:
curl https://raw.githubusercontent.com/nisiddharth/ytplay/main/ytplay > ~/.local/bin/ytplay && chmod +x ~/.local/bin/ytplay
Also, the script needs YouTube Data API key for searching. You can either keep that in ~/.api_keys/YT_API_KEY
or edit the appropriate line in the script.
ytplay something just like this
Presents these 10 search results on fzf
and plays the selected video on pressing enter: