A POSIX script that helps you find Youtube videos (without API) and opens/downloads them using mpv/youtube-dl
These links will take you where you want to go with the snap of a finger
- Thumbnails
- History
- Download
- Format selection
- Queue multiple videos
ytfzf [Options] <search-query>
Videos can be selected using fzf, dmenu or rofi.
To quit the script you can press
ESC
or^C
in the video selection prompt.
~/.config/ytfzf/conf.sh
, example config file
.
Any variable change mentioned below can be exported, or added to the config file.
requires ueberzug (works only on X11), doesn't work on wayland and macos
```sh
ytfzf -t <search-query>
```
Thumbnails preview side could be changed to the right with
--preview-side=right
-
ytfzf -H
- clear history
ytfzf -x
- History file:
~/.cache/ytfzf/ytfzf_hst
History is enabled by default. To turn it off you can export
YTFZF_HIST=0
or set add it to the config file.
-
-D
: To use external menu
By default the external menu is set to dmenu -i -l 30
. This can be changed to rofi
```sh
YTFZF_EXTMENU=' rofi -dmenu -fuzzy -width 1500'
```
The width of external menu can be adjusted with
YTFZF_EXTMENU_LEN=220
.
-
- Video format can be set as per youtube-dl formatting.
YTFZF_PREF="22" # 22 for 720p
-
-f
: To view and select available formats. -
-m
: (audio-only) Only audio format (best audio) -
-d
: (download) To download a video instead of playing it.
multiple videos can be queued up using fzf
's auto multi-selection (tab). To traverse between selected videos use <
and >
.
-
-l
: (loop) would prompt the video menu every time a video finishes. PressESC
or^C
to exit loop.-s
: (search-again) would ask for another search query as the video ends.
To select videos without video prompt, if multiple videos are selected then they would play one after the other. The variable n represents the link count. Which is 1 by default.
+ `-A`: (select-all) selects all the videos.
+ `-a`: (auto-selection) selects the first **n**(=1) result.
+ `-r`: (auto-selection) Randomly selects **n**(=1) results (shuffles them).
+ `-n <number>` : (link-count) Set **n** the number of links to be selected.
Subscriptions are managed in subscription file: ~/.config/ytfzf/subscriptions
.
+ Adding a certain channel to subscriptions
1. Open the channel page on a browser and go to the vidoes tab (located right below the channel name and subscription count).
2. Copy the url of videos page. And add it to your subscription file.
3. The url for each subscription must be on a separate line.
The subscription file needs to have only the channels' video page url. Comments can be added with #
```
# file : ~/.config/ytfzf/subscriptions
## tech channels
https://www.youtube.com/c/LukeSmithxyz/videos # luke smith
https://www.youtube.com/channel/UCngn7SVujlvskHRvRKc1cTw/videos # bugswriter
https://www.youtube.com/c/DistroTube/videos # distrotube
https://www.youtube.com/c/MentalOutlaw/videos # mental outlaw
```
To see subscriptions' latest videos
```sh
# Defaults to 10 results from each channel
ytfzf -S
# To show 15 results instead
ytfzf --subs=15
```
This can be combined with other options like thumbnails
```sh
ytfzf -tS
```
By default, ytfzf
uses mpv
. Custom player should have the ability to launch youtube links (example: vlc
).
```sh
# example: using devour
FZF_PLAYER="devour mpv"
YTFZF_PLAYER_FORMAT="devour mpv --ytdl-format="
```
-
-
The currently playing video details are stored in
~/.cache/ytfzf_cur
(for status bar modules) -
Files and directories used by ytfzf can be set in the config file
cache_dir="$HOME/.cache/ytfzf" history_file="$YTFZF_CACHE/ytfzf_hst" current_file="$YTFZF_CACHE/ytfzf_cur" thumb_dir="$YTFZF_CACHE/thumb"
-
f
: full screenj
,J
: cycle subtitles (also works with audio, if the music video has subtitles)L
: single-loop
-
Search with Thumbnails
Find and watch videos with thumbnail previews
ytfzf -t <query>
Show all subscriptions with thumbnails (latest 10)
ytfzf -St
-
You can use multiple options together, here are some examples
-
Stream audio (music), and prompt as the music finishes
ytfzf -ml <query>
-
Download a video from your history
ytfzf -dH
-
Open using external menu in a certain format
ytfzf -fD
-
-
If you started watching a video and you wish to change format then first hit Q to save position and quit mpv, then choose your format using
ytfzf -faH
- Subscriptions
- Now ytfzf can queue videos using fzf multiselect option. Press tab to select a video. All the videos will be lined up in mpv. Use
>
and<
to traverse them. - Make continuous queries with
-s
- Thumbnails! Using Ueberzug. Inspired by
fontpreview-ueberzug
. - added MacOS support
- Stdin can be taken by using
ytfzf -
, for both fzf and external menu.
Fzf is optional, you can use an external menu (like dmenu) with the -D
option (no thumbnail support).
mpv
youtube-dl
fzf
(Optional) - for menujq
- to parse jsonueberzug
(Optional) - for thumbnails
Thumbnails only work with fzf and Ueberzug as of now.
-
sudo pacman -S jq mpv youtube-dl fzf
For thumbnails
sudo pacman -S ueberzug
-
sudo apt install jq mpv youtube-dl fzf
For thumbnails
pip install ueberzug
Note youtube-dl is usually outdated in debian repos, I suggest getting it from youtube-dl github
-
brew install jq mpv youtube-dl fzf
At the moment thumbnail previews aren't working on MacOS
-
sudo curl -L "https://raw.githubusercontent.com/pystardust/ytfzf/master/ytfzf" -o /usr/bin/ytfzf sudo chmod +x /usr/bin/ytfzf
-
git clone https://github.com/pystardust/ytfzf cd ytfzf
-
sudo make install
-
sudo make uninstall
-
-
Arch users can install ytfzf from the AUR
yay -S ytfzf-git
-
Gentoo users can install ytfzf from the nitratesky overlay
eselect repository enable nitratesky emerge -a1 net-misc/ytfzf
- Playlists
- More sites
- Subscriptions
- Thumbnails
- dwm with swallow patch: Images don't render when looped (ie, option -l)
- If thubnails are not working
.Xautority
might be causing it. Try deleting.Xauthority
and relogging.