2

Christos Angelopoulos / magic-tape · GitLab

 1 year ago
source link: https://gitlab.com/christosangel/magic-tape
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

magic-tape

Magic-tape is an image supporting fuzzy finder command line interface YouTube client.

Image support is achieved either with kitty terminal, ueberzug or chafa.

With magic-tape, through the main menu, the user can

  • Browse videos from subscriptions.
  • Browse through trending video feed.
  • make a video search, using keywords or phrases.
  • Watch a previously watched video (watch history).
  • Browse videos from a subcsribed channel.
  • Watch a liked video.
  • Repeat the previous selection.
  • Repeat a previous search (search history).
  • Watch/download video/audio content, in various formats.

Through the miscellaneous menu the user can

  • Set up Preferences (configuration).
  • Like / Unlike a video.
  • Synchronize the above actions with their YouTube account.
  • Import subscriptions from YouTube.
  • Subscribe to/ Unsubscribe from a channel.
  • Clear their watch/search history, liked videos, thumbnail cache.

Dependencies

Instructions on installing yt-dlp can be found here:

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

Easily install yt-dlp using pip:

Other dependencies include:

Regarding image support, it can either be achived with

or with

  • chafa

    $ sudo apt install chafa

To install these dependencies, run the following command:

Install

To run the script, first you need to make it executable:

Then, run with kitty:

or any other terminal emulator:

Usage

Set up

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

  • 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:

Entering the respective key, the user can :

key Action
f Browse their Subscriptions Feed.
t Browse YouTube Trending Feed.
s Search for a key word/phrase
r Repeat previous selection.
c Select a Subscribed Channel Feed.
l Browse Liked Videos.
h Browse Watch History.
j Browse Search History.
m Open Miscellaneous Menu.
q Quit the program.
  • In order for the f & t 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:

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
  • Download Video 🔽
  • Download Audio 🔽
  • Like Video ❤️
  • Browse Feed of channel that uploaded the video 📺
  • Subscribe to the channel that uploaded the video 📋
  • Open in browser 🌐
  • Quit ❌

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

Miscellaneous Menu

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
l LIKE a video.
L UNLIKE a video.
I Import subscriptions from YouTube.
n Subscribe to a new channel.
u Unsubscribe to a new channel.
H Clear watch history.
S Clear search history.
T Clear thumbnail cache.
q Quit this menu, Return to Main Menu.

Subscribing to a new channel

Selecting the n option of the Miscellaneous Menu, the user can subscribe to a new channel.

Initially, the user is asked to enter a keyword / keyphrase to search channels with.

Channel selection then is made with fzf:

  • In the n & u options of the Miscellaneous Menu (subcribe/unsubscribe to a channel), after a selection, the user will be asked to sync the changes manually to their YouTube account.

  • Liking/Unliking a video and unsubscribing from a channel options are done with rofi:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK