A command-line tool to search and play YouTube videos using fzf and mpv.
- curl: For making HTTP requests.
- grep: For pattern matching.
- jq: For processing JSON data.
- fzf: For fuzzy finding and selection.
- mpv: For playing videos.
- chafa: For displaying image previews (optional, but recommended).
-
Make sure you have all the prerequisites installed. On Debian/Ubuntu, you can install them using:
sudo apt update sudo apt install curl grep jq fzf mpv chafa
On macOS, you can use Homebrew:
brew install curl jq fzf mpv chafa
-
Download or clone this repository.
-
Make the
ytzscript executable:chmod +x ytz
-
(Optional) Add the script to your
$PATHfor easy access from any directory. For example, you can move it to/usr/local/bin:sudo mv ytz /usr/local/bin/
ytz [-a] [search_query]
-a: Audio only mode (disables video).[search_query]: The YouTube search query. If omitted, you will be prompted to enter a search query.
-
Search and play a video:
ytz "epic sax guy" -
Search and play audio only:
ytz -a "lofi hip hop radio" -
Search with a prompt:
ytz
(You will be prompted to enter a search query.)
- The script uses
mpvwith the following default options:--volume=50. - Image previews in
fzfdepend on your terminal's capabilities and thechafacommand.
- If you encounter errors, ensure that all prerequisites are installed correctly and that your network connection is working.
- If YouTube changes its page structure, the script may break. Please report any issues.
