README.md

db597a03bc7a1786d5261e8a55628da30193c775
youtube-tui/README.md rendered · source · history · blame · raw

148 lines · 6886 bytes

YouTube TUI

An aesthetically pleasing YouTube TUI written in Rust.

Warning

The current code on GitHub is a rewritten-from-scratch version of the old code, it is not functional yet. Therefore if you would like to try the TUI out, please install it from crates.io (seen Installation).

Changes

Framework

Now uses the TUI framework from tui-additions which I wrote specifically for this project. The main benefits of this are that all "items" are no longer related to each other, so changing one of them won't break the others. This modular framework also make fixing bugs in existing items and adding new ones much easier (which is the main reason that I decided to rewrite the entire thing from scratch).

The main drawbacks of using a framework is there are limitations of what I can do (the old code does excatly what I wanted it to, but it's a hella mess), and the performance may take a hit (just slightly, TUIs written in Rust are still blazingly fast!!!).

Config files readability

The old config files uses the YAML format, which is usually very easy to read, but when it comes to tuples and custom struct representation it actually look pure gibberish.

The new config files are also in YAML, but I prevented tuples from appearing in them by removing stuff nobody is gonna change anyways and options that are gonna break the entire thing anyways, so that even a 6 year old Roblox player would have the ability to read and modify their config.

No docs on the config until I finish the whole thing, so if you want to figure out stuff go read the code yourself it's not that bad now.

Sixels!

You can now display PNGs in terminal yay! Very slow and lots of delay, trying to get it work multithreaded so that it can still be usable but with no success. If anyone knows how to do that (or just make it faster) please help.

Code readability

The code is now more idiomatic and i put comments so yeah go read it and i will memorize the arch wiki

Progress

Done
  • Config files (mostly, more options will be added when I get to that part)
  • Home page with its basic items
To do before release
  • Search filters
  • All pages (search, video/playlist/channel info)
  • Basically back to where it is before the rewrite

Overview

YouTube TUI is a text user interface that provides a clean TUI for browsing YouTube. It can perform YouTube query searches, view and inspect channels, and play the desired content as a regular video or audio-only stream for saving bandwidth.

Screenshot

User manual

YouTube TUI user manual

Installation

Install from crates.io

cargo install youtube-tui

Clone from GitHub and build

git clone https://github.com/sirusmart/youtube-tui && cd youtube-tui && cargo build --release

Once build, the compiled binary will be located at ./target/release/youtube-tui. The program is not in your path yet, so you'll have to manually move to to a place from which you would be able to execute it. A common way to do so is to copy the binary executable to /usr/local/bin/youtube-tui.

Dependencies

This program does not requires any dependencies, but it is suggested these three things on your system that can be launched via command:

  1. A video player (Defaults to mpv)
  2. A terminal emulator (Defaults to konsole)
  3. A YouTube downloader (Defaults to yt-dlp, strongly suggest NOT to use youtube-dl because it is now very slow)

None of these dependencies are required as you can change them in config (in commands.yml)

Usage

  • A video player (Defaults to MPV)
  • A terminal emulator (Defaults to konsole)
  • A YouTube downloader (Defaults to yt-dlp, it is recommended that you do not use yt-dl, as the download speeds are ludicrously slow)

None of these dependencies is required, and you can change the defaults in the config file commands.yml

Movement

Key What does it do
Arrow/Vim keys Move in the corresponding direction
Enter Select/Launch
Q Quit the program

Check the user manual here

Note

These keys only work when nothing is selected. When something is selected, your key presses are passed directly to the "object" you've selected. Press escape (Esc) if you want to deselect.

Config

All config files are located at ~/.config/youtube-tui/, will write documentation for that later

Known issues

Missing hash key: "selected"

When viewing the playlists page in a channel, it gives you a Missing hash key: "selected". This is because Invidious was not able to fetch the requested playlists.

You should also see an error when visiting this URL

Here's the opened issue

Todo (First priority on top)

  • Go directly to a page by URL
  • Vim-like commands in the status bar
  • Save as local playlist/video
  • Command line launch options
  • Channel search and channel video sort
  • Recommended videos

Help needed

Guys please I need help I'm kinda bad at coding tbh, so these are stuff that I need help with

  • Publishing to the AUR
  • Printing full resolution images to the terminal with Sixel

Credits

  • ytfzf by pystardust - The TUI I used to watch on YouTube, gave me an idea of how this program is going to work
  • Terminal Typeracer by Darrien Glasser - A very clean-looking TUI for typing speed test, gave me an idea of how this program should look like
  • Invidious - For having a nice API for doing YouTube searches and stuff. (I made a wrapper for the API you can check it here out if you want to)

... and of course, credits to myself for not having the ability to read the docs for ytfzf and decided to make my own instead.

Anything Missing?

If there is a bug or you got a nice idea of what can be added to this program, feel free to open a GitHub issue. Thx :D