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.
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
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
While using the script for the first time, the user will be asked for his preferences:
-
Prefered action Selector, can either be
rofi
,fzf
ordmenu
. -
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.
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).
Once the program is run, the user is presented with the Main Menu:
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 is done with fzf:
Note that I am not using thumbnails here.
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/
The m option of the Main Menu opens up the Miscellaneous Menu:
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:
- 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/
- The action selection can be either with
rofi
, orfzf
(if the user wants to go full TUI).This can be configured during the P option of the misc menu. dmenu
is also added as an action selector. This can be configured during the P option of the misc menu.- 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 +