Skip to content

A better way to watch youtube. No ads, no tracking and no distractions. Pure focus and education (or entertainment).

License

Notifications You must be signed in to change notification settings

Kiog-Aser/YT-Focus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YT-Focus

A better way to watch youtube. No ads, no tracking and no distractions. Pure focus and education (or entertainment). YT-Focus is a CLI that allows people to find and watch youtube videos completely locally (on their device) without ever having to open the youtube website.

A fork of 'Magic Tape' by Christos Angelopoulos

The original version has more features, but I want a more minimalistic and 'focused' approach.

The 'no-thumbnail' branch has an updated script for people who don't want to use thumbnails. That script doesn't download any thumnails, which this one does.

With YT Focus, through the main menu, the user can

  • Browse videos from subscriptions.

  • make a video search, using keywords or phrases.

  • Watch a previously watched video (watch history).

  • Browse videos from a subcsribed channel.

  • Watch/download video/audio content, in various formats.

Through the miscellaneous menu the user can

  • Set up Preferences (configuration).

  • Import subscriptions from YouTube.

  • Subscribe to/ Unsubscribe from a channel.

Dependencies

Instructions on installing yt-dlp can be found here:

https://github.com/yt-dlp/yt-dlp#installation

Easily install yt-dlp using pip:

pip install yt-dlp

Other dependencies include:

Regarding image support, it can either be achived with

sudo apt install kitty

with

or with

sudo apt install chafa

To install these dependencies, run the following command:

sudo apt install curl fzf mpv jq xclip

To install rofi:

sudo apt install rofi

To install dmenu:

sudo apt install dmenu

Install

git clone https://github.com/Kiog-Aser/YT-Focus.git

cd YT-Focus/

To run the script from any directory, it has to be made executable, and then copied to $PATH,:

chmod +x magic-tape.sh

cp magic-tape.sh ~/.local/bin/

After that, the user must run this command in order to create the necessary directories:

mkdir -p ~/.cache/magic-tape/history/ ~/.cache/magic-tape/jpg/ ~/.cache/magic-tape/json/ ~/.cache/magic-tape/search/video/

mkdir -p ~/.cache/magic-tape/search/channels/ ~/.cache/magic-tape/subscriptions/jpg/ ~/.config/magic-tape/

Copy png/ directory to ~/.cache/magic-tape/

cp -r png/ ~/.cache/magic-tape/png/

Now, run with kitty:

kitty -T magic-tape magic-tape.sh

or any other terminal emulator:

magic-tape.sh

Usage

Set up

While using the script for the first time, the user will be asked for his preferences:

  • Prefered action Selector, can either be rofi,fzf or dmenu.

  • Prefered web browser, the cookies of which will be used by magic-tape in order to extract data from YouTube. Supported browsers by yt-dlp are brave, chrome, chromium, edge, firefox, opera, vivaldi.

  • Prefered video list length to get in each request. Longer video lists may be more preferable, but take longer to get.

  • Dialog message delay time: the time a message in the cli window remains visible, in seconds.

  • Notification message delay time: the time a notification remains visible, in seconds.

  • Image Support: either kitty, ueberzug or none.

  • Toggle multi-color terminal messages.

The user can always alter these preferences using the P option of the Miscellaneous Menu.

Import Subscribed channels

When the script is run for the first time, it would be advisable for the user to import their subcsribed channels from YouTube.

The user user can do that by navigating to the Miscellaneous Menu (option m), then selecting Import Subscriptions from YouTube (option I).

Main Menu

Once the program is run, the user is presented with the Main Menu:

image 1

Entering the respective key, the user can :

key Action
f Browse their Subscriptions Feed. (Not working yet)
s Search for a key word/phrase
c Select a Subscribed Channel Feed.
h Browse Watch History.
m Open Miscellaneous Menu.
q Quit the program.
  • In order for the f option to function, the user must already be logged in to their browser.

  • Selecting channel feed, Browsing watch history, search history & liked videos is done with rofi:

Video selection

Video selection is done with fzf:

image 6 Note that I am not using thumbnails here.

Search shortcuts

Shortcut Function
Enter, Right Arrow Accept
Esc Abort Selection
Shift+Right Arrow Next Page
Shift+Left Arrow Previous Page

Once a video is selected, the user is prompted to select action:

  • Play ⭐Video 360p

  • Play ⭐⭐Video 720p

  • Play ⭐⭐⭐Best Video/Live

  • Play ⭐⭐⭐Best Audio

  • Browse Feed of channel that uploaded the video 📺

  • Quit ❌

Audio & Video files will be downloaded at ~/Desktop/

Miscellaneous Menu

The m option of the Main Menu opens up the Miscellaneous Menu:

image 8

Entering the respective key, the user can :

key Action
P Set Up Preferences
I Import subscriptions from YouTube.
n Subscribe to a new channel.
u Unsubscribe to a new channel.
q Quit this menu, Return to Main Menu.

UPDATES:

  1. The directory structure of the program has been updated. Instead of keeping everything in ~git/magic-tape/, now various files and directories are kept in various places.This way,
  • the magic-tape.sh is in ~/.local/bin/
  • the magic-tape cache files are all in ~/.cache/magic-tape/
  • the configuration text file will be created in ~/.config/magic-tape/
  1. The action selection can be either with rofi, or fzf (if the user wants to go full TUI).This can be configured during the P option of the misc menu.
  2. dmenu is also added as an action selector. This can be configured during the P option of the misc menu.
  3. There is now a duration filter prompt in the search option which allows you to:
  • Not add any filter

  • Exclude shorts (semi working)

  • Only show videos with a duration of 0-4 mins

  • Only show videos with a duration of 4-20 mins

  • Only show videos with a duration of 20 mins +


About

A better way to watch youtube. No ads, no tracking and no distractions. Pure focus and education (or entertainment).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages