User Tools


client:ytfzf

yt-fzf

yt-fzf is a posix script to find and watch youtube videos from the terminal. Unfortenetly public instances wont work so we have to run our own locally.

git clone https://github.com/pystardust/ytfzf.git
make
sudo make install

Edit the config file

vim .config/ytfzf/conf.sh

And add this content:

#!/bin/sh

# This is a sample config file, refer to ytfzf(5) for more information

ytdl_pref='bestvideo[height<=?1080]+bestaudio/best'
sub_link_count=8
log_level=0
show_thumbnails=1
pages_start=1
is_loop=1
search_again=1
multi_search=1
invidious_instance="http://localhost:3000"
search_again_shortcut="ctrl-g"

# Thumb
load_thumbnail_viewer="chafa"
thumbnail_quality="default"
fzf_preview_side="right"
sort_by="upload_date"
export FZF_DEFAULT_OPTS="--height=100%"

on_opt_parse_c () {
    arg="$1"
    case "$arg" in
	SI|S) is_loop=1 ;;
    esac
}

download_thumbnails() {
    for thumb in "$@"; do
        url="${thumb%;*}"
        id="${thumb#*;}"
        curl -s -L "$url" -o "$thumb_dir/$id.jpg" >/dev/null 2>&1 &
    done
    wait
}

Invidous Instance

Install Dependencys

sudo pacman -S crystal shards postgresql

Compile Invidious

git clone https://github.com/iv-org/invidious
cd invidious
shards install
crystal build src/invidious.cr --release

Initialise Database and start postgres:

sudo su - postgres -c 'initdb -D /var/lib/postgres/data'
postgresql

Copy the infivous config file over:

cp config/config.example.yml config/config.yml

And change the following entrys in config/config.yml:

db:
  user: postgres
  password: ""
  dbname: invidious
  host: localhost
  port: 5432

hmac_key: "8f3d342cfb8a11d93e9f"

Postgres

Login into postgres

sudo -u postgres psql

Within the psql-Prompt:

CREATE USER invidious WITH PASSWORD 'invidious';
CREATE DATABASE invidious OWNER invidious;
\q

Import DB-Scheme:

psql -U invidious -h localhost -d invidious < config/sql/channels.sql
psql -U invidious -h localhost -d invidious < config/sql/videos.sql
psql -U invidious -h localhost -d invidious < config/sql/users.sql
psql -U invidious -h localhost -d invidious < config/sql/session_ids.sql
psql -U invidious -h localhost -d invidious < config/sql/nonces.sql
psql -U invidious -h localhost -d invidious < config/sql/channel_videos.sql

Now you can start invidious

./invidious

MPV Config

Add this to ~/.config/mpv/mpv.conf to surpress unecessary clutter while playing videos.

audio-device=pulse 
vo=x11
profile=sw-fast minimal)
hwdec=no 

no-terminal 
really-quiet
msg-level=all=no  Fehler, AV/VO Logs etc.

Add both postgres and invidous to your boot runlevel.

sudo rc-update add postgres default
sudo rc-update add invidous default

Now you can search anything with yt-fzf.

ytfzf Anything

Done! Have fun with ytfzf