ytsub

ytsub is a subscriptions only tui youtube client that uses the invidious api.

demo

Dependencies

mpv and yt-dlp are optional dependencies for playing videos.

sqlite is a required dependency. If it is not available on the system, it can be compiled and linked by enabling the bundled_sqlite feature when building with cargo:

cargo build --features bundled_sqlite

Installation

Cargo

```bash cargo install ytsub

or

cargo install ytsub --features bundled_sqlite ```

Arch Linux

ytsub is available in the AUR as stable source package, stable binary package and latest development package. You can install it using your preferred AUR helper.

```bash

stable source package

paru -S ytsub

stable binary package

paru -S ytsub-bin

latest development package

paru -S ytsub-git ```

Usage

``` Usage: ytsub [OPTIONS] [COMMAND]

Commands: import Import subscriptions export Export subscriptions help Print this message or the help of the given subcommand(s)

Options: -c, --config Path to configuration file -n, --no-config Ignore configuration file -d, --database Path to database file -s, --instances Path to instances file -g, --gen-instances Generate Invidious instances file --video-player

For default key bindings, press ctrl-h in the app or refer to the example config.toml file.

Configuration

Default directory of the configuration files is $HOME/.config/ytsub.

| File | Description | |------------------------------|-----------------------------------------------| | config.toml | option, key binding and theme configurations | | instances | list of invidious instances |

config.toml

Path to the configuration file can be specified with the -c flag.

Example config.toml with default values

```toml

Options

database = "/home/username/.local/share/ytsub/videos.db" # Path to database file instances = "/home/username/.config/ytsub/instances" # Path to instances file tabs = ["videos"] # Tabs to fetch videos from [possible values: videos, shorts, streams] api = "invidious" # API to be used for fetching videos [possible values: invidious, local] refreshthreshold = 600 # Time in seconds that needs to pass before refreshing a channel using the refreshchannels command rssthreshold = 125 # Use RSS if the number of channels being refreshed or being subscribed to exceeds the specified amount tickrate = 200 # Tick rate in milliseconds requesttimeout = 5 # Request timeout in seconds highlightsymbol = "" # Symbol to highlight selected items videoplayer = "mpv" # Path to video player hidewatched = false # Hide watched videos by default

Theme

fg and bg fields can be set with rgb (ex: "255, 255, 255"),

hex (ex: "#ffffff") or named colors.

Valid color names are Black, Red, Green, Yellow, Blue, Magenta

Cyan, Gray, DarkGray, LightRed, LightGreen, LightGreen,

LightYellow, LightBlue, LightMagenta, LightCyan, White and Reset.

Valid modifiers are bold, dim, italic, underlined,

slowblink, rapidblink, reversed, hidden and crossed_out.

Example:

[title]

fg = "#123456"

bg = "10, 250, 99"

modifiers = "bold reversed italic"

Example with alternative syntax:

title = { fg = "#123456", bg = "10, 250, 99", modifiers = "bold reversed italic" }

Block titles

[title] fg = "Cyan" modifiers = "bold"

Channel, Title, Length and Date headers

[header] fg = "Yellow" modifiers = "bold"

Selected item in inactive block

[selected] fg = "Blue" modifiers = "bold"

Selected item in active block

[focused] fg = "Magenta" modifiers = "bold"

Watched videos

[watched] fg = "DarkGray"

Selected watched video in inactive block

Overrides the modifiers of [selected]. If fg and bg are set, they are patched to [selected]

[selected_watched]

Selected watched video in active block

Overrides the modifiers of [focused]. If fg and bg are set, they are patched to [focused]

[focused_watched]

Border of selected block

[selected_block] fg = "Magenta"

Error message

[error] fg = "Red"

Warning message

[warning] fg = "Yellow"

Key bindings in the help window

[help] fg = "Green"

Key Bindings

Valid key codes are backspace, space, enter, left, right, up, down, home, end

pageup, pagedown, tab, backtab, del, delete, insert, esc, escape and characters.

Valid modifiers are ctrl, shift and alt.

Multiple key bindings can be set in a single line.

Example: "escape q ctrl-c" = "quit"

A default binding can be removed by setting it to an empty string.

Example: "q" = ""

[keybindings] "1" = "setmodesubs" # Switch to subscriptions mode "2" = "setmodelatestvideos" # Switch to latest videos mode "j down" = "ondown" # Go one line downward "k up" = "onup" # Go one line upward "h left" = "onleft" # Switch to channels block "l right" = "onright" # Switch to videos block "g" = "selectfirst" # Jump to the first line in the list "G" = "selectlast" # Jump to the last line in the list "c" = "jumptochannel" # Jump to the channel of the selected video from latest videos mode "t" = "togglehide" # Hide/unhide watched videos "i" = "subscribe" # Enter editing mode to enter channel id or url "d" = "unsubscribe" # Open confirmation window to unsubcribe from the selected channel "D" = "deletevideo" # Delete the selected video from database "/" = "searchforward" # Enter editing mode to make a forward search "?" = "searchbackward" # Enter editing mode to make a backward search "n" = "repeatlastsearch" # Search with the latest pattern and direction "N" = "repeatlastsearchopposite" # Search with the latest pattern and opposite direction "s" = "switchapi" # Switch between the available APIs "r" = "refreshchannel" # Refresh videos of the selected channel "R" = "refreshchannels" # Refresh videos of every channel "F" = "refreshfailedchannels" # Refresh videos of channels which their latest refresh was a failure "o" = "openininvidious" # Open channel or video Invidious page in browser "O" = "openinyoutube" # Open channel or video Youtube page in browser "p" = "playvideo" # Play selected video in a video player (default: mpv) "m" = "togglewatched" # Mark/unmark selected video as watched "ctrl-h" = "togglehelp" # Toggle help window "T" = "toggletag" # Toggle tag window "q ctrl-c" = "quit" # Quit application

[keybindings.import] "space" = "toggleselection" # Select/Unselect channel "a" = "selectall" # Select all channels "z" = "deselectall" # Deselect all channels "enter" = "import" # Import selected channels

[keybindings.tag] "i" = "createtag" "d" = "deletetag" "r" = "renametag" "s" = "selectchannels" # Pick channels for the tag "space" = "toggleselection" # Select/Unselect tag "a" = "selectall" # Select all tags "z" = "deselectall" # Deselect all tags

[keybindings.channelselection] "enter" = "confirm" # Confirm the selection of channels "escape" = "abort" # Drop changes "space" = "toggleselection" # Select/Unselect channel "a" = "selectall" # Select all channels "z" = "deselect_all" # Deselect all channels ```

instances

A custom path to the instances file can be specified with the -i flag. The file can either be manually created by adding instances that have api enabled or automatically generated from the instances in https://api.invidious.io by running the app with -g flag. Every instance entry is separated by a line. If the instances file doesn't exist, every time the app is launched, instances list will be built from https://api.invidious.io.

Example instances file

https://vid.puffyan.us https://invidio.xamh.de https://inv.riverside.rocks https://yt.artemislena.eu