Play YouTube videos from the command line in a convenient way
Find a file
2021-10-06 11:22:43 +02:00
images update screenshot 2021-10-05 19:00:12 +02:00
flake.lock rewrite 2021-10-05 18:50:28 +02:00
flake.nix rewrite 2021-10-05 18:50:28 +02:00
README.org update README 2021-10-06 11:22:43 +02:00
tyt handle empty query 2021-10-06 11:18:30 +02:00

tyt

Terminal YouTube (tyt) is a small bash script that lets you play YouTube videos by query from the command line.

/denis/tyt/media/branch/main/images/screenshot.png

Features

  • Search and play videos with one command
  • Interactively select a video from a list
  • Download a video to the current working directory

There is a --music flag, so you can substitute video with song in the above list.

Execution

This project is a Nix flake. If you have a recent Nix version and flakes are enabled, you can execute the script via:

nix run github:Deleh/tyt -- --help

If not you can clone the repo, make sure the dependencies listed below are fulfilled and execute tyt manually:

./tyt --help

Dependencies

If you are running tyt as Nix flake you don't have to care about dependencies. A mpv version with scripts is used by default, this enables MPRIS support and skipping sponsored segments of videos.

If you are not running Nix, make sure the following dependencies are installed on your system and hope that everything works:

Usage

  Usage: tyt [OPTIONS] QUERIES ... [OPTIONS]

  Play YouTube videos from the command line in a convenient way.

  OPTIONS
    -h,  --help         Show this help message
    -a*, --alternative  Play an alternative video (e.g. -aaa for third
                        alternative)
    -d,  --download     Download video (or audio if -m is provided) to the current
                        directory
    -i,  --interactive  Interactive mode (overrides --alternative)
    -m,  --music        Play only the audio track

  EXAMPLES
    tyt Elephants Dream                    # Search for 'Elephants Dream' and play
                                           # the video
    tyt -m The Beatles - Yellow Submarine  # Search for 'The Beatles - Yellow
                                           # Submarine' and play only the music
    tyt -i -s Elephants Dream              # Search for 'Elephants Dream'
                                           # interactively and download the
                                           # selected video